import (
"context"
"errors"
- "runtime"
"sync"
"sync/atomic"
"time"
)
+const sleepDru = 100
+
var (
ptr = &struct{}{}
ErrWaitTo = errors.New("ErrWaitTo")
if len(to) > 0 && time.Since(be) > to[0] {
return ErrWaitTo
}
- time.Sleep(time.Millisecond * 100)
- runtime.Gosched()
+ time.Sleep(time.Millisecond * sleepDru)
+ // runtime.Gosched()
}
for !ctx.r32.CompareAndSwap(0, -1) {
if len(to) > 0 && time.Since(be) > to[0] {
return ErrWaitTo
}
- time.Sleep(time.Millisecond * 100)
- runtime.Gosched()
+ time.Sleep(time.Millisecond * sleepDru)
+ // runtime.Gosched()
}
if len(to) > 0 && time.Since(be) > to[0] {
return ErrWaitTo