| 440 | } |
| 441 | |
| 442 | s32 OSSuspendThread(OSThread* thread) |
| 443 | { |
| 444 | BOOL enabled; |
| 445 | s32 suspendCount; |
| 446 | |
| 447 | enabled = OSDisableInterrupts(); |
| 448 | suspendCount = thread->suspend++; |
| 449 | if (suspendCount == 0) |
| 450 | { |
| 451 | switch (thread->state) |
| 452 | { |
| 453 | case OS_THREAD_STATE_RUNNING: |
| 454 | RunQueueHint = TRUE; |
| 455 | thread->state = OS_THREAD_STATE_READY; |
| 456 | break; |
| 457 | case OS_THREAD_STATE_READY: |
| 458 | UnsetRun(thread); |
| 459 | break; |
| 460 | case OS_THREAD_STATE_WAITING: |
| 461 | RemoveItem(thread->queue, thread, link); |
| 462 | thread->priority = 32; |
| 463 | AddTail(thread->queue, thread, link); |
| 464 | if (thread->mutex) |
| 465 | { |
| 466 | UpdatePriority(thread->mutex->thread); |
| 467 | } |
| 468 | break; |
| 469 | } |
| 470 | |
| 471 | __OSReschedule(); |
| 472 | } |
| 473 | OSRestoreInterrupts(enabled); |
| 474 | return suspendCount; |
| 475 | } |
| 476 | |
| 477 | void OSSleepThread(OSThreadQueue* queue) |
| 478 | { |
no test coverage detected