Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(263)

Side by Side Diff: src/pkg/runtime/netpoll.goc

Issue 8670044: code review 8670044: net: implement netpoll for windows (Closed)
Patch Set: diff -r 8de6d4c58935 https://go.googlecode.com/hg/ Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Go Authors. All rights reserved. 1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin linux 5 // +build darwin linux windows
6 6
7 package net 7 package net
8 8
9 #include "runtime.h" 9 #include "runtime.h"
10 #include "defs_GOOS_GOARCH.h" 10 #include "defs_GOOS_GOARCH.h"
11 #include "arch_GOARCH.h" 11 #include "arch_GOARCH.h"
12 #include "malloc.h" 12 #include "malloc.h"
13 13
14 // Integrated network poller (platform-independent part). 14 // Integrated network poller (platform-independent part).
15 // A particular implementation (epoll/kqueue) must define the following function s: 15 // A particular implementation (epoll/kqueue) must define the following function s:
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 static G* 265 static G*
266 netpollunblock(PollDesc *pd, int32 mode, bool ioready) 266 netpollunblock(PollDesc *pd, int32 mode, bool ioready)
267 { 267 {
268 G **gpp, *old; 268 G **gpp, *old;
269 269
270 gpp = &pd->rg; 270 gpp = &pd->rg;
271 if(mode == 'w') 271 if(mode == 'w')
272 gpp = &pd->wg; 272 gpp = &pd->wg;
273 » if(*gpp == READY) 273 » if(*gpp == READY) {
dvyukov 2013/06/25 12:00:32 drop {}
brainman 2013/06/26 07:18:05 Done.
274 return nil; 274 return nil;
275 }
275 if(*gpp == nil) { 276 if(*gpp == nil) {
276 // Only set READY for ioready. runtime_pollWait 277 // Only set READY for ioready. runtime_pollWait
277 // will check for timeout/cancel before waiting. 278 // will check for timeout/cancel before waiting.
278 if(ioready) 279 if(ioready)
279 *gpp = READY; 280 *gpp = READY;
280 return nil; 281 return nil;
281 } 282 }
282 old = *gpp; 283 old = *gpp;
283 // pass unblock reason onto blocked g 284 // pass unblock reason onto blocked g
284 old->param = (void*)ioready; 285 old->param = (void*)ioready;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 for(i = 0; i < n; i++) { 362 for(i = 0; i < n; i++) {
362 pd[i].link = pollcache.first; 363 pd[i].link = pollcache.first;
363 pollcache.first = &pd[i]; 364 pollcache.first = &pd[i];
364 } 365 }
365 } 366 }
366 pd = pollcache.first; 367 pd = pollcache.first;
367 pollcache.first = pd->link; 368 pollcache.first = pd->link;
368 runtimeĀ·unlock(&pollcache); 369 runtimeĀ·unlock(&pollcache);
369 return pd; 370 return pd;
370 } 371 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b