Changeset 05e2a7ad in mainline for generic/src/synch/waitq.c
- Timestamp:
- 2005-12-07T13:32:31Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 839470f
- Parents:
- 253f8590
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/synch/waitq.c
r253f8590 r05e2a7ad 34 34 #include <arch/asm.h> 35 35 #include <arch/types.h> 36 #include <typedefs.h> 36 37 #include <time/timeout.h> 37 38 #include <arch.h> … … 68 69 thread_t *t = (thread_t *) data; 69 70 waitq_t *wq; 70 int do_wakeup = 0;71 bool do_wakeup = false; 71 72 72 73 spinlock_lock(&threads_lock); … … 76 77 grab_locks: 77 78 spinlock_lock(&t->lock); 78 if (wq = t->sleep_queue) { 79 if (wq = t->sleep_queue) { /* assignment */ 79 80 if (!spinlock_trylock(&wq->lock)) { 80 81 spinlock_unlock(&t->lock); 81 goto grab_locks; 82 goto grab_locks; /* avoid deadlock */ 82 83 } 83 84 84 85 list_remove(&t->wq_link); 85 86 t->saved_context = t->sleep_timeout_context; 86 do_wakeup = 1;87 do_wakeup = true; 87 88 88 89 spinlock_unlock(&wq->lock); … … 90 91 } 91 92 92 t->timeout_pending = 0;93 t->timeout_pending = false; 93 94 spinlock_unlock(&t->lock); 94 95 95 if (do_wakeup) thread_ready(t); 96 if (do_wakeup) 97 thread_ready(t); 96 98 97 99 out: … … 194 196 return ESYNCH_TIMEOUT; 195 197 } 196 THREAD->timeout_pending = 1;198 THREAD->timeout_pending = true; 197 199 timeout_register(&THREAD->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, THREAD); 198 200 } … … 228 230 * will be woken up and missed count will be zeroed. 229 231 */ 230 void waitq_wakeup(waitq_t *wq, intall)232 void waitq_wakeup(waitq_t *wq, bool all) 231 233 { 232 234 ipl_t ipl; … … 251 253 * will be woken up and missed count will be zeroed. 252 254 */ 253 void _waitq_wakeup_unsafe(waitq_t *wq, intall)255 void _waitq_wakeup_unsafe(waitq_t *wq, bool all) 254 256 { 255 257 thread_t *t; … … 258 260 if (list_empty(&wq->head)) { 259 261 wq->missed_wakeups++; 260 if (all) wq->missed_wakeups = 0; 262 if (all) 263 wq->missed_wakeups = 0; 261 264 return; 262 265 } … … 267 270 spinlock_lock(&t->lock); 268 271 if (t->timeout_pending && timeout_unregister(&t->sleep_timeout)) 269 t->timeout_pending = 0;272 t->timeout_pending = false; 270 273 t->sleep_queue = NULL; 271 274 spinlock_unlock(&t->lock); … … 273 276 thread_ready(t); 274 277 275 if (all) goto loop; 276 } 278 if (all) 279 goto loop; 280 }
Note:
See TracChangeset
for help on using the changeset viewer.