Changeset b5e68c8 in mainline for kernel/generic/src/synch/waitq.c
- Timestamp:
- 2011-05-12T16:49:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f36787d7
- Parents:
- e80329d6 (diff), 750636a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/waitq.c
re80329d6 rb5e68c8 127 127 /** Interrupt sleeping thread. 128 128 * 129 * This routine attempts to interrupt a thread from its sleep in a waitqueue. 130 * If the thread is not found sleeping, no action is taken. 129 * This routine attempts to interrupt a thread from its sleep in 130 * a waitqueue. If the thread is not found sleeping, no action 131 * is taken. 132 * 133 * The threads_lock must be already held and interrupts must be 134 * disabled upon calling this function. 131 135 * 132 136 * @param thread Thread to be interrupted. … … 138 142 DEADLOCK_PROBE_INIT(p_wqlock); 139 143 140 irq_spinlock_lock(&threads_lock, true); 141 if (!thread_exists(thread)) 142 goto out; 144 /* 145 * The thread is quaranteed to exist because 146 * threads_lock is held. 147 */ 143 148 144 149 grab_locks: … … 150 155 /* 151 156 * The sleep cannot be interrupted. 152 *153 157 */ 154 158 irq_spinlock_unlock(&thread->lock, false); 155 goto out;159 return; 156 160 } 157 161 158 162 if (!irq_spinlock_trylock(&wq->lock)) { 163 /* Avoid deadlock */ 159 164 irq_spinlock_unlock(&thread->lock, false); 160 165 DEADLOCK_PROBE(p_wqlock, DEADLOCK_THRESHOLD); 161 /* Avoid deadlock */162 166 goto grab_locks; 163 167 } … … 173 177 irq_spinlock_unlock(&wq->lock, false); 174 178 } 179 175 180 irq_spinlock_unlock(&thread->lock, false); 176 181 177 182 if (do_wakeup) 178 183 thread_ready(thread); 179 180 out:181 irq_spinlock_unlock(&threads_lock, true);182 184 } 183 185 … … 370 372 * If the thread was already interrupted, 371 373 * don't go to sleep at all. 372 *373 374 */ 374 375 if (THREAD->interrupted) { … … 381 382 * Set context that will be restored if the sleep 382 383 * of this thread is ever interrupted. 383 *384 384 */ 385 385 THREAD->sleep_interruptible = true;
Note:
See TracChangeset
for help on using the changeset viewer.