LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 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 // This file implements runtime support for signal handling. | 5 // This file implements runtime support for signal handling. |
6 // | 6 // |
7 // Most synchronization primitives are not available from | 7 // Most synchronization primitives are not available from |
8 // the signal handler (it cannot block and cannot use locks) | 8 // the signal handler (it cannot block and cannot use locks) |
9 // so the handler communicates with a processing goroutine | 9 // so the handler communicates with a processing goroutine |
10 // via struct sig, below. | 10 // via struct sig, below. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 break; | 105 break; |
106 } | 106 } |
107 recv[i] = m; | 107 recv[i] = m; |
108 if(m != 0) | 108 if(m != 0) |
109 more = 1; | 109 more = 1; |
110 } | 110 } |
111 if(more) | 111 if(more) |
112 continue; | 112 continue; |
113 | 113 |
114 // Sleep waiting for more. | 114 // Sleep waiting for more. |
115 » » runtime·entersyscall(); | 115 » » runtime·entersyscallblock(); |
116 runtime·notesleep(&sig); | 116 runtime·notesleep(&sig); |
117 runtime·exitsyscall(); | 117 runtime·exitsyscall(); |
118 } | 118 } |
119 | 119 |
120 done:; | 120 done:; |
121 // goc requires that we fall off the end of functions | 121 // goc requires that we fall off the end of functions |
122 // that return values instead of using our own return | 122 // that return values instead of using our own return |
123 // statements. | 123 // statements. |
124 } | 124 } |
125 | 125 |
(...skipping 16 matching lines...) Expand all Loading... |
142 sig.wanted[i] = ~(uint32)0; | 142 sig.wanted[i] = ~(uint32)0; |
143 runtime·sigenable(s); | 143 runtime·sigenable(s); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 if(s >= nelem(sig.wanted)*32) | 147 if(s >= nelem(sig.wanted)*32) |
148 return; | 148 return; |
149 sig.wanted[s/32] |= 1U<<(s&31); | 149 sig.wanted[s/32] |= 1U<<(s&31); |
150 runtime·sigenable(s); | 150 runtime·sigenable(s); |
151 } | 151 } |
LEFT | RIGHT |