lee

Results 2 issues of lee

修改promise内存布局,提高了安全性,减少了内存占用

Promise由于其特殊性,必须是pin的,不能够移动在内存中的位置,所以new函数返回一个Promise指针依旧有可能不安全,且*sync.Mutex和*sync.WaitGroup虽然为了内存不可移动声明为指针类型,但是占用了更多内存,且*sync.Mutex是不必要的,建议将代码修改为如下布局,更安全,并节约资源 ``` type Promise[T any] struct { *promise[T] } type promise[T any] struct { runnable func(resolve func(T), reject func(error)) result T err error wait sync.WaitGroup pending atomic.Bool } ```