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 dragonfly freebsd linux netbsd openbsd windows solaris | 5 // +build darwin dragonfly freebsd linux netbsd openbsd windows solaris |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 else if(mode == 'w') | 106 else if(mode == 'w') |
107 pd->wg = nil; | 107 pd->wg = nil; |
108 ret: | 108 ret: |
109 runtime·unlock(pd); | 109 runtime·unlock(pd); |
110 } | 110 } |
111 | 111 |
112 func runtime_pollWait(pd *PollDesc, mode int) (err int) { | 112 func runtime_pollWait(pd *PollDesc, mode int) (err int) { |
113 runtime·lock(pd); | 113 runtime·lock(pd); |
114 err = checkerr(pd, mode); | 114 err = checkerr(pd, mode); |
115 if(err == 0) { | 115 if(err == 0) { |
| 116 #ifdef GOOS_solaris |
| 117 if(mode == 'r') |
| 118 runtime·netpollarmread(pd->fd); |
| 119 else if(mode == 'w') |
| 120 runtime·netpollarmwrite(pd->fd); |
| 121 #endif |
116 while(!netpollblock(pd, mode)) { | 122 while(!netpollblock(pd, mode)) { |
117 err = checkerr(pd, mode); | 123 err = checkerr(pd, mode); |
118 if(err != 0) | 124 if(err != 0) |
119 break; | 125 break; |
120 // Can happen if timeout has fired and unblocked us, | 126 // Can happen if timeout has fired and unblocked us, |
121 // but before we had a chance to run, timeout has been r
eset. | 127 // but before we had a chance to run, timeout has been r
eset. |
122 // Pretend it has not happened and retry. | 128 // Pretend it has not happened and retry. |
123 } | 129 } |
124 } | 130 } |
125 runtime·unlock(pd); | 131 runtime·unlock(pd); |
126 } | 132 } |
127 | 133 |
128 func runtime_pollWaitCanceled(pd *PollDesc, mode int) { | 134 func runtime_pollWaitCanceled(pd *PollDesc, mode int) { |
129 runtime·lock(pd); | 135 runtime·lock(pd); |
| 136 #ifdef GOOS_solaris |
| 137 if(mode == 'r') |
| 138 runtime·netpollarmread(pd->fd); |
| 139 else if(mode == 'w') |
| 140 runtime·netpollarmwrite(pd->fd); |
| 141 #endif |
130 // wait for ioready, ignore closing or timeouts. | 142 // wait for ioready, ignore closing or timeouts. |
131 while(!netpollblock(pd, mode)) | 143 while(!netpollblock(pd, mode)) |
132 ; | 144 ; |
133 runtime·unlock(pd); | 145 runtime·unlock(pd); |
134 } | 146 } |
135 | 147 |
136 func runtime_pollSetDeadline(pd *PollDesc, d int64, mode int) { | 148 func runtime_pollSetDeadline(pd *PollDesc, d int64, mode int) { |
137 G *rg, *wg; | 149 G *rg, *wg; |
138 | 150 |
139 runtime·lock(pd); | 151 runtime·lock(pd); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 for(i = 0; i < n; i++) { | 395 for(i = 0; i < n; i++) { |
384 pd[i].link = pollcache.first; | 396 pd[i].link = pollcache.first; |
385 pollcache.first = &pd[i]; | 397 pollcache.first = &pd[i]; |
386 } | 398 } |
387 } | 399 } |
388 pd = pollcache.first; | 400 pd = pollcache.first; |
389 pollcache.first = pd->link; | 401 pollcache.first = pd->link; |
390 runtime·unlock(&pollcache); | 402 runtime·unlock(&pollcache); |
391 return pd; | 403 return pd; |
392 } | 404 } |
LEFT | RIGHT |