| 405 | } |
| 406 | |
| 407 | s32 OSResumeThread(OSThread* thread) |
| 408 | { |
| 409 | BOOL enabled; |
| 410 | s32 suspendCount; |
| 411 | |
| 412 | enabled = OSDisableInterrupts(); |
| 413 | suspendCount = thread->suspend--; |
| 414 | if (thread->suspend < 0) |
| 415 | { |
| 416 | thread->suspend = 0; |
| 417 | } |
| 418 | else if (thread->suspend == 0) |
| 419 | { |
| 420 | switch (thread->state) |
| 421 | { |
| 422 | case OS_THREAD_STATE_READY: |
| 423 | thread->priority = __OSGetEffectivePriority(thread); |
| 424 | SetRun(thread); |
| 425 | break; |
| 426 | case OS_THREAD_STATE_WAITING: |
| 427 | RemoveItem(thread->queue, thread, link); |
| 428 | thread->priority = __OSGetEffectivePriority(thread); |
| 429 | AddPrio(thread->queue, thread, link); |
| 430 | if (thread->mutex) |
| 431 | { |
| 432 | UpdatePriority(thread->mutex->thread); |
| 433 | } |
| 434 | break; |
| 435 | } |
| 436 | __OSReschedule(); |
| 437 | } |
| 438 | OSRestoreInterrupts(enabled); |
| 439 | return suspendCount; |
| 440 | } |
| 441 | |
| 442 | s32 OSSuspendThread(OSThread* thread) |
| 443 | { |
no test coverage detected