| 514 | } |
| 515 | |
| 516 | s32 OSSuspendThread(OSThread* thread) { |
| 517 | BOOL enabled; |
| 518 | s32 suspendCount; |
| 519 | |
| 520 | enabled = OSDisableInterrupts(); |
| 521 | suspendCount = thread->suspend++; |
| 522 | if (suspendCount == 0) { |
| 523 | switch (thread->state) { |
| 524 | case OS_THREAD_STATE_RUNNING: |
| 525 | RunQueueHint = TRUE; |
| 526 | thread->state = OS_THREAD_STATE_READY; |
| 527 | break; |
| 528 | case OS_THREAD_STATE_READY: |
| 529 | UnsetRun(thread); |
| 530 | break; |
| 531 | case OS_THREAD_STATE_WAITING: |
| 532 | RemoveItem(thread->queue, thread, link); |
| 533 | thread->priority = 32; |
| 534 | AddTail(thread->queue, thread, link); |
| 535 | if (thread->mutex) { |
| 536 | UpdatePriority(thread->mutex->thread); |
| 537 | } |
| 538 | break; |
| 539 | } |
| 540 | |
| 541 | __OSReschedule(); |
| 542 | } |
| 543 | OSRestoreInterrupts(enabled); |
| 544 | return suspendCount; |
| 545 | } |
| 546 | |
| 547 | void OSSleepThread(OSThreadQueue* queue) { |
| 548 | BOOL enabled; |
no test coverage detected