Changes in kernel/generic/src/synch/waitq.c [df58e44:1d432f9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/waitq.c
rdf58e44 r1d432f9 127 127 /** Interrupt sleeping thread. 128 128 * 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. 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. 135 131 * 136 132 * @param thread Thread to be interrupted. … … 142 138 DEADLOCK_PROBE_INIT(p_wqlock); 143 139 144 /* 145 * The thread is quaranteed to exist because 146 * threads_lock is held. 147 */ 140 irq_spinlock_lock(&threads_lock, true); 141 if (!thread_exists(thread)) 142 goto out; 148 143 149 144 grab_locks: … … 155 150 /* 156 151 * The sleep cannot be interrupted. 152 * 157 153 */ 158 154 irq_spinlock_unlock(&thread->lock, false); 159 return;155 goto out; 160 156 } 161 157 162 158 if (!irq_spinlock_trylock(&wq->lock)) { 163 /* Avoid deadlock */164 159 irq_spinlock_unlock(&thread->lock, false); 165 160 DEADLOCK_PROBE(p_wqlock, DEADLOCK_THRESHOLD); 161 /* Avoid deadlock */ 166 162 goto grab_locks; 167 163 } … … 177 173 irq_spinlock_unlock(&wq->lock, false); 178 174 } 179 180 175 irq_spinlock_unlock(&thread->lock, false); 181 176 182 177 if (do_wakeup) 183 178 thread_ready(thread); 179 180 out: 181 irq_spinlock_unlock(&threads_lock, true); 184 182 } 185 183 … … 372 370 * If the thread was already interrupted, 373 371 * don't go to sleep at all. 372 * 374 373 */ 375 374 if (THREAD->interrupted) { … … 382 381 * Set context that will be restored if the sleep 383 382 * 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.