// a goroutine consumes the notification by changing the state to nil.
// pdWait - a goroutine prepares to park on the semaphore, but not yet parked;
// the goroutine commits to park by changing the state to G pointer,
-// or, alternatively, concurrent io notification changes the state to READY,
+// or, alternatively, concurrent io notification changes the state to pdReady,
// or, alternatively, concurrent timeout/close changes the state to nil.
// G pointer - the goroutine is blocked on the semaphore;
-// io notification or timeout/close changes the state to READY or nil respectively
+// io notification or timeout/close changes the state to pdReady or nil respectively
// and unparks the goroutine.
-// nil - nothing of the above.
+// nil - none of the above.
const (
pdReady uintptr = 1
pdWait uintptr = 2
gpp = &pd.wg
}
- // set the gpp semaphore to WAIT
+ // set the gpp semaphore to pdWait
for {
old := *gpp
if old == pdReady {
}
}
- // need to recheck error states after setting gpp to WAIT
+ // need to recheck error states after setting gpp to pdWait
// this is necessary because runtime_pollUnblock/runtime_pollSetDeadline/deadlineimpl
// do the opposite: store to closing/rd/wd, membarrier, load of rg/wg
if waitio || netpollcheckerr(pd, mode) == 0 {
gopark(netpollblockcommit, unsafe.Pointer(gpp), waitReasonIOWait, traceEvGoBlockNet, 5)
}
- // be careful to not lose concurrent READY notification
+ // be careful to not lose concurrent pdReady notification
old := atomic.Xchguintptr(gpp, 0)
if old > pdWait {
throw("runtime: corrupted polldesc")
return nil
}
if old == 0 && !ioready {
- // Only set READY for ioready. runtime_pollWait
+ // Only set pdReady for ioready. runtime_pollWait
// will check for timeout/cancel before waiting.
return nil
}