summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/netpoll_windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/netpoll_windows.c')
-rw-r--r--src/pkg/runtime/netpoll_windows.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/runtime/netpoll_windows.c b/src/pkg/runtime/netpoll_windows.c
index b510a41e2..f3cd15c7a 100644
--- a/src/pkg/runtime/netpoll_windows.c
+++ b/src/pkg/runtime/netpoll_windows.c
@@ -72,6 +72,13 @@ runtime·netpollclose(uintptr fd)
return 0;
}
+void
+runtime·netpollarm(PollDesc* pd, int32 mode)
+{
+ USED(pd, mode);
+ runtime·throw("unused");
+}
+
// Polls for completed network IO.
// Returns list of goroutines that become runnable.
G*
@@ -94,13 +101,17 @@ retry:
n = nelem(entries) / runtime·gomaxprocs;
if(n < 8)
n = 8;
+ if(block)
+ m->blocked = true;
if(runtime·stdcall(runtime·GetQueuedCompletionStatusEx, 6, iocphandle, entries, (uintptr)n, &n, (uintptr)wait, (uintptr)0) == 0) {
+ m->blocked = false;
errno = runtime·getlasterror();
if(!block && errno == WAIT_TIMEOUT)
return nil;
runtime·printf("netpoll: GetQueuedCompletionStatusEx failed (errno=%d)\n", errno);
runtime·throw("netpoll: GetQueuedCompletionStatusEx failed");
}
+ m->blocked = false;
for(i = 0; i < n; i++) {
op = entries[i].op;
errno = 0;
@@ -113,7 +124,10 @@ retry:
op = nil;
errno = 0;
qty = 0;
+ if(block)
+ m->blocked = true;
if(runtime·stdcall(runtime·GetQueuedCompletionStatus, 5, iocphandle, &qty, &key, &op, (uintptr)wait) == 0) {
+ m->blocked = false;
errno = runtime·getlasterror();
if(!block && errno == WAIT_TIMEOUT)
return nil;
@@ -123,6 +137,7 @@ retry:
}
// dequeued failed IO packet, so report that
}
+ m->blocked = false;
handlecompletion(&gp, op, errno, qty);
}
if(block && gp == nil)