LEFT | RIGHT |
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 freebsd,amd64 freebsd,386 linux openbsd windows | 5 // +build darwin freebsd,amd64 freebsd,386 linux openbsd 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" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 | 208 |
209 func runtime_Semacquire(addr *uint32) { | 209 func runtime_Semacquire(addr *uint32) { |
210 runtime·semacquire(addr, true); | 210 runtime·semacquire(addr, true); |
211 } | 211 } |
212 | 212 |
213 func runtime_Semrelease(addr *uint32) { | 213 func runtime_Semrelease(addr *uint32) { |
214 runtime·semrelease(addr); | 214 runtime·semrelease(addr); |
215 } | 215 } |
216 | 216 |
| 217 uintptr |
| 218 runtime·netpollfd(PollDesc *pd) |
| 219 { |
| 220 return pd->fd; |
| 221 } |
| 222 |
217 // make pd ready, newly runnable goroutines (if any) are enqueued info gpp list | 223 // make pd ready, newly runnable goroutines (if any) are enqueued info gpp list |
218 void | 224 void |
219 runtime·netpollready(G **gpp, PollDesc *pd, int32 mode) | 225 runtime·netpollready(G **gpp, PollDesc *pd, int32 mode) |
220 { | 226 { |
221 G *rg, *wg; | 227 G *rg, *wg; |
222 | 228 |
223 rg = wg = nil; | 229 rg = wg = nil; |
224 runtime·lock(pd); | 230 runtime·lock(pd); |
225 if(mode == 'r' || mode == 'r'+'w') | 231 if(mode == 'r' || mode == 'r'+'w') |
226 rg = netpollunblock(pd, 'r', true); | 232 rg = netpollunblock(pd, 'r', true); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 for(i = 0; i < n; i++) { | 375 for(i = 0; i < n; i++) { |
370 pd[i].link = pollcache.first; | 376 pd[i].link = pollcache.first; |
371 pollcache.first = &pd[i]; | 377 pollcache.first = &pd[i]; |
372 } | 378 } |
373 } | 379 } |
374 pd = pollcache.first; | 380 pd = pollcache.first; |
375 pollcache.first = pd->link; | 381 pollcache.first = pd->link; |
376 runtime·unlock(&pollcache); | 382 runtime·unlock(&pollcache); |
377 return pd; | 383 return pd; |
378 } | 384 } |
LEFT | RIGHT |