Changeset 43114c5 in mainline for src/synch/waitq.c
- Timestamp:
- 2005-04-09T18:22:53Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8262010
- Parents:
- e6ba9a3f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/synch/waitq.c
re6ba9a3f r43114c5 130 130 * there are timeouts in progress. 131 131 */ 132 spinlock_lock(& the->thread->lock);133 if ( the->thread->timeout_pending) {134 spinlock_unlock(& the->thread->lock);132 spinlock_lock(&THREAD->lock); 133 if (THREAD->timeout_pending) { 134 spinlock_unlock(&THREAD->lock); 135 135 cpu_priority_restore(pri); 136 136 goto restart; 137 137 } 138 spinlock_unlock(& the->thread->lock);138 spinlock_unlock(&THREAD->lock); 139 139 140 140 spinlock_lock(&wq->lock); … … 160 160 * Now we are firmly decided to go to sleep. 161 161 */ 162 spinlock_lock(& the->thread->lock);162 spinlock_lock(&THREAD->lock); 163 163 if (usec) { 164 164 /* We use the timeout variant. */ 165 if (!context_save(& the->thread->sleep_timeout_context)) {165 if (!context_save(&THREAD->sleep_timeout_context)) { 166 166 /* 167 167 * Short emulation of scheduler() return code. 168 168 */ 169 spinlock_unlock(& the->thread->lock);169 spinlock_unlock(&THREAD->lock); 170 170 cpu_priority_restore(pri); 171 171 return ESYNCH_TIMEOUT; 172 172 } 173 the->thread->timeout_pending = 1;174 timeout_register(& the->thread->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, the->thread);175 } 176 177 list_append(& the->thread->wq_link, &wq->head);173 THREAD->timeout_pending = 1; 174 timeout_register(&THREAD->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, THREAD); 175 } 176 177 list_append(&THREAD->wq_link, &wq->head); 178 178 179 179 /* 180 180 * Suspend execution. 181 181 */ 182 the->thread->state = Sleeping;183 the->thread->sleep_queue = wq;184 185 spinlock_unlock(& the->thread->lock);182 THREAD->state = Sleeping; 183 THREAD->sleep_queue = wq; 184 185 spinlock_unlock(&THREAD->lock); 186 186 187 187 scheduler(); /* wq->lock is released in scheduler_separated_stack() */
Note:
See TracChangeset
for help on using the changeset viewer.