Rev 1579 | Rev 1593 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1579 | Rev 1580 | ||
|---|---|---|---|
| Line 309... | Line 309... | ||
| 309 | /* |
309 | /* |
| 310 | * Now we are firmly decided to go to sleep. |
310 | * Now we are firmly decided to go to sleep. |
| 311 | */ |
311 | */ |
| 312 | spinlock_lock(&THREAD->lock); |
312 | spinlock_lock(&THREAD->lock); |
| 313 | 313 | ||
| 314 | if (THREAD->interrupted) { |
- | |
| 315 | spinlock_unlock(&THREAD->lock); |
- | |
| 316 | spinlock_unlock(&wq->lock); |
- | |
| 317 | return ESYNCH_INTERRUPTED; |
- | |
| 318 | } |
- | |
| 319 | - | ||
| 320 | if (flags & SYNCH_FLAGS_INTERRUPTIBLE) { |
314 | if (flags & SYNCH_FLAGS_INTERRUPTIBLE) { |
| - | 315 | ||
| - | 316 | /* |
|
| - | 317 | * If the thread was already interrupted, |
|
| - | 318 | * don't go to sleep at all. |
|
| - | 319 | */ |
|
| - | 320 | if (THREAD->interrupted) { |
|
| - | 321 | spinlock_unlock(&THREAD->lock); |
|
| - | 322 | spinlock_unlock(&wq->lock); |
|
| - | 323 | return ESYNCH_INTERRUPTED; |
|
| - | 324 | } |
|
| - | 325 | ||
| 321 | /* |
326 | /* |
| 322 | * Set context that will be restored if the sleep |
327 | * Set context that will be restored if the sleep |
| 323 | * of this thread is ever interrupted. |
328 | * of this thread is ever interrupted. |
| 324 | */ |
329 | */ |
| 325 | THREAD->sleep_interruptible = true; |
330 | THREAD->sleep_interruptible = true; |
| 326 | if (!context_save(&THREAD->sleep_interruption_context)) { |
331 | if (!context_save(&THREAD->sleep_interruption_context)) { |
| 327 | /* Short emulation of scheduler() return code. */ |
332 | /* Short emulation of scheduler() return code. */ |
| 328 | spinlock_unlock(&THREAD->lock); |
333 | spinlock_unlock(&THREAD->lock); |
| 329 | return ESYNCH_INTERRUPTED; |
334 | return ESYNCH_INTERRUPTED; |
| 330 | } |
335 | } |
| - | 336 | ||
| 331 | } else { |
337 | } else { |
| 332 | THREAD->sleep_interruptible = false; |
338 | THREAD->sleep_interruptible = false; |
| 333 | } |
339 | } |
| 334 | 340 | ||
| 335 | if (usec) { |
341 | if (usec) { |