1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:18:35 -06:00

runtime: fix potential deadlock in netpoll on windows

If netpoll has been told to block, it must not return with nil,
otherwise scheduler assumes that netpoll is disabled.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/11920044
This commit is contained in:
Dmitriy Vyukov 2013-07-27 13:46:40 +04:00
parent 29f17fb01c
commit 91d35ad1b8

View File

@ -71,6 +71,8 @@ runtime·netpoll(bool block)
if(iocphandle == INVALID_HANDLE_VALUE)
return nil;
gp = nil;
retry:
o = nil;
errno = 0;
qty = 0;
@ -104,7 +106,8 @@ runtime·netpoll(bool block)
}
o->errno = errno;
o->qty = qty;
gp = nil;
runtime·netpollready(&gp, (void*)o->runtimeCtx, mode);
if(block && gp == nil)
goto retry;
return gp;
}