File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ const (
3535)
3636
3737const (
38- starvationThresholdNs = 1e6
39- sleepTimeNs = 1e4 * time .Nanosecond
38+ starvationThresholdNs = int64 ( 1e6 )
39+ sleepTimeNs = 1e7 * time .Nanosecond
4040)
4141
4242var (
@@ -91,7 +91,7 @@ func StartAsync() {
9191 atomic .StoreInt32 ((* int32 )(& asyncCtx .lock ), state_wait )
9292 go func () {
9393 lock := (* int32 )(& asyncCtx .lock )
94- waitStartTime := time .Now ().Nanosecond ()
94+ waitStartTime := time .Now ().UnixNano ()
9595
9696 for {
9797 // Check for incoming request, if any, otherwise busy waits
@@ -120,8 +120,8 @@ func StartAsync() {
120120 default :
121121 // busy wait, then sleep after 1ms
122122 if waitStartTime == 0 {
123- waitStartTime = time .Now ().Nanosecond ()
124- } else if time .Now ().Nanosecond ()- waitStartTime > starvationThresholdNs {
123+ waitStartTime = time .Now ().UnixNano ()
124+ } else if time .Now ().UnixNano ()- waitStartTime > starvationThresholdNs {
125125 time .Sleep (sleepTimeNs )
126126 }
127127 }
You can’t perform that action at this time.
0 commit comments