OLD | NEW |
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 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "defs.h" | 6 #include "defs.h" |
7 #include "signals.h" | 7 #include "signals.h" |
8 #include "os.h" | 8 #include "os.h" |
9 | 9 |
10 // Linux futex. | 10 // Linux futex. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 void | 168 void |
169 unlock(Lock *l) | 169 unlock(Lock *l) |
170 { | 170 { |
171 m->locks--; | 171 m->locks--; |
172 if(m->locks < 0) | 172 if(m->locks < 0) |
173 throw("lock count"); | 173 throw("lock count"); |
174 futexunlock(l); | 174 futexunlock(l); |
175 } | 175 } |
176 | 176 |
| 177 void |
| 178 destroylock(Lock *l) |
| 179 { |
| 180 } |
| 181 |
177 | 182 |
178 // One-time notifications. | 183 // One-time notifications. |
179 // | 184 // |
180 // Since the lock/unlock implementation already | 185 // Since the lock/unlock implementation already |
181 // takes care of sleeping in the kernel, we just reuse it. | 186 // takes care of sleeping in the kernel, we just reuse it. |
182 // (But it's a weird use, so it gets its own interface.) | 187 // (But it's a weird use, so it gets its own interface.) |
183 // | 188 // |
184 // We use a lock to represent the event: | 189 // We use a lock to represent the event: |
185 // unlocked == event has happened. | 190 // unlocked == event has happened. |
186 // Thus the lock starts out locked, and to wait for the | 191 // Thus the lock starts out locked, and to wait for the |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 271 } |
267 | 272 |
268 // Called to initialize a new m (including the bootstrap m). | 273 // Called to initialize a new m (including the bootstrap m). |
269 void | 274 void |
270 minit(void) | 275 minit(void) |
271 { | 276 { |
272 // Initialize signal handling. | 277 // Initialize signal handling. |
273 m->gsignal = malg(32*1024); // OS X wants >=8K, Linux >=2K | 278 m->gsignal = malg(32*1024); // OS X wants >=8K, Linux >=2K |
274 signalstack(m->gsignal->stackguard, 32*1024); | 279 signalstack(m->gsignal->stackguard, 32*1024); |
275 } | 280 } |
OLD | NEW |