Commit 91d35ad1 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 29f17fb0
...@@ -71,6 +71,8 @@ runtime·netpoll(bool block) ...@@ -71,6 +71,8 @@ runtime·netpoll(bool block)
if(iocphandle == INVALID_HANDLE_VALUE) if(iocphandle == INVALID_HANDLE_VALUE)
return nil; return nil;
gp = nil;
retry:
o = nil; o = nil;
errno = 0; errno = 0;
qty = 0; qty = 0;
...@@ -104,7 +106,8 @@ runtime·netpoll(bool block) ...@@ -104,7 +106,8 @@ runtime·netpoll(bool block)
} }
o->errno = errno; o->errno = errno;
o->qty = qty; o->qty = qty;
gp = nil;
runtime·netpollready(&gp, (void*)o->runtimeCtx, mode); runtime·netpollready(&gp, (void*)o->runtimeCtx, mode);
if(block && gp == nil)
goto retry;
return gp; return gp;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment