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 // Time-related runtime and pieces of package time. | 5 // Time-related runtime and pieces of package time. |
6 | 6 |
7 package time | 7 package time |
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 if(delta < 0) { | 207 if(delta < 0) { |
208 // No timers left - put goroutine to sleep. | 208 // No timers left - put goroutine to sleep. |
209 timers.rescheduling = true; | 209 timers.rescheduling = true; |
210 runtime·park(runtime·unlock, &timers, "timer goroutine (
idle)"); | 210 runtime·park(runtime·unlock, &timers, "timer goroutine (
idle)"); |
211 continue; | 211 continue; |
212 } | 212 } |
213 // At least one timer pending. Sleep until then. | 213 // At least one timer pending. Sleep until then. |
214 timers.sleeping = true; | 214 timers.sleeping = true; |
215 runtime·noteclear(&timers.waitnote); | 215 runtime·noteclear(&timers.waitnote); |
216 runtime·unlock(&timers); | 216 runtime·unlock(&timers); |
217 » » runtime·entersyscallblock(); | 217 » » runtime·notetsleepg(&timers.waitnote, delta); |
218 » » runtime·notetsleep(&timers.waitnote, delta); | |
219 » » runtime·exitsyscall(); | |
220 } | 218 } |
221 } | 219 } |
222 | 220 |
223 // heap maintenance algorithms. | 221 // heap maintenance algorithms. |
224 | 222 |
225 static void | 223 static void |
226 siftup(int32 i) | 224 siftup(int32 i) |
227 { | 225 { |
228 int32 p; | 226 int32 p; |
229 Timer **t, *tmp; | 227 Timer **t, *tmp; |
(...skipping 30 matching lines...) Expand all Loading... |
260 if(t[c]->when >= t[i]->when) | 258 if(t[c]->when >= t[i]->when) |
261 break; | 259 break; |
262 tmp = t[i]; | 260 tmp = t[i]; |
263 t[i] = t[c]; | 261 t[i] = t[c]; |
264 t[c] = tmp; | 262 t[c] = tmp; |
265 t[i]->i = i; | 263 t[i]->i = i; |
266 t[c]->i = c; | 264 t[c]->i = c; |
267 i = c; | 265 i = c; |
268 } | 266 } |
269 } | 267 } |
OLD | NEW |