Rev 1375 | Rev 1502 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1375 | Rev 1467 | ||
|---|---|---|---|
| Line 222... | Line 222... | ||
| 222 | ipl_t ipl; |
222 | ipl_t ipl; |
| 223 | 223 | ||
| 224 | restart: |
224 | restart: |
| 225 | ipl = interrupts_disable(); |
225 | ipl = interrupts_disable(); |
| 226 | 226 | ||
| - | 227 | if (THREAD) { /* needed during system initiailzation */ |
|
| 227 | /* |
228 | /* |
| 228 | * Busy waiting for a delayed timeout. |
229 | * Busy waiting for a delayed timeout. |
| 229 | * This is an important fix for the race condition between |
230 | * This is an important fix for the race condition between |
| 230 | * a delayed timeout and a next call to waitq_sleep_timeout(). |
231 | * a delayed timeout and a next call to waitq_sleep_timeout(). |
| 231 | * Simply, the thread is not allowed to go to sleep if |
232 | * Simply, the thread is not allowed to go to sleep if |
| 232 | * there are timeouts in progress. |
233 | * there are timeouts in progress. |
| 233 | */ |
234 | */ |
| 234 | spinlock_lock(&THREAD->lock); |
235 | spinlock_lock(&THREAD->lock); |
| 235 | if (THREAD->timeout_pending) { |
236 | if (THREAD->timeout_pending) { |
| - | 237 | spinlock_unlock(&THREAD->lock); |
|
| - | 238 | interrupts_restore(ipl); |
|
| - | 239 | goto restart; |
|
| - | 240 | } |
|
| 236 | spinlock_unlock(&THREAD->lock); |
241 | spinlock_unlock(&THREAD->lock); |
| 237 | interrupts_restore(ipl); |
- | |
| 238 | goto restart; |
- | |
| 239 | } |
242 | } |
| 240 | spinlock_unlock(&THREAD->lock); |
- | |
| 241 | 243 | ||
| 242 | spinlock_lock(&wq->lock); |
244 | spinlock_lock(&wq->lock); |
| 243 | return ipl; |
245 | return ipl; |
| 244 | } |
246 | } |
| 245 | 247 | ||