diff options
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/netpoll_select.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libgo/runtime/netpoll_select.c b/libgo/runtime/netpoll_select.c index b4613359118..033661d17f2 100644 --- a/libgo/runtime/netpoll_select.c +++ b/libgo/runtime/netpoll_select.c @@ -135,6 +135,8 @@ runtime_netpoll(bool block) byte b; struct stat st; + allocatedfds = false; + retry: runtime_lock(&selectlock); @@ -146,11 +148,13 @@ runtime_netpoll(bool block) } if(inuse) { - prfds = runtime_SysAlloc(4 * sizeof fds, &mstats.other_sys); - pwfds = prfds + 1; - pefds = pwfds + 1; - ptfds = pefds + 1; - allocatedfds = true; + if(!allocatedfds) { + prfds = runtime_SysAlloc(4 * sizeof fds, &mstats.other_sys); + pwfds = prfds + 1; + pefds = pwfds + 1; + ptfds = pefds + 1; + allocatedfds = true; + } } else { prfds = &grfds; pwfds = &gwfds; @@ -216,7 +220,7 @@ runtime_netpoll(bool block) mode = 'r' + 'w'; --c; } - if(i == rdwake) { + if(i == rdwake && mode != 0) { while(read(rdwake, &b, sizeof b) > 0) ; continue; |