mirror of
https://github.com/fumiama/water.git
synced 2026-06-12 14:10:36 +08:00
add lock
This commit is contained in:
@@ -396,10 +396,14 @@ RETRY:
|
|||||||
w.rate.update(uint64(packetSize))
|
w.rate.update(uint64(packetSize))
|
||||||
case windows.ERROR_NO_MORE_ITEMS:
|
case windows.ERROR_NO_MORE_ITEMS:
|
||||||
if !shouldSpin || uint64(nanotime()-start) >= spinloopDuration {
|
if !shouldSpin || uint64(nanotime()-start) >= spinloopDuration {
|
||||||
|
w.mu.Unlock()
|
||||||
windows.WaitForSingleObject(w.readwait, windows.INFINITE)
|
windows.WaitForSingleObject(w.readwait, windows.INFINITE)
|
||||||
|
w.mu.Lock()
|
||||||
goto RETRY
|
goto RETRY
|
||||||
}
|
}
|
||||||
|
w.mu.Unlock()
|
||||||
procyield(1)
|
procyield(1)
|
||||||
|
w.mu.Lock()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return n, err
|
return n, err
|
||||||
|
|||||||
Reference in New Issue
Block a user