remove thread from active queue. Reset id and state
| 134 | |
| 135 | // remove thread from active queue. Reset id and state |
| 136 | void __OSDeactivateThread(OSThread_t* thread) |
| 137 | { |
| 138 | cemu_assert_debug(__OSHasSchedulerLock()); |
| 139 | |
| 140 | // remove thread from active thread list |
| 141 | MPTR t = memory_getVirtualOffsetFromPointer(thread); |
| 142 | srwlock_activeThreadList.LockWrite(); |
| 143 | bool noHit = true; |
| 144 | for (sint32 i = 0; i < activeThreadCount; i++) |
| 145 | { |
| 146 | if (activeThread[i] == t) |
| 147 | { |
| 148 | activeThread[i] = activeThread[activeThreadCount - 1]; |
| 149 | activeThreadCount--; |
| 150 | noHit = false; |
| 151 | break; |
| 152 | } |
| 153 | } |
| 154 | cemu_assert_debug(noHit == false); |
| 155 | srwlock_activeThreadList.UnlockWrite(); |
| 156 | |
| 157 | g_activeThreadQueue->removeThread(thread, &thread->activeThreadChain); // todo - check if thread in queue |
| 158 | |
| 159 | cemu_assert_debug(thread->state == OSThread_t::THREAD_STATE::STATE_NONE); |
| 160 | thread->id = 0x8000; |
| 161 | |
| 162 | __OSDeleteHostThread(thread); |
| 163 | } |
| 164 | |
| 165 | bool __OSIsThreadActive(OSThread_t* thread) |
| 166 | { |
no test coverage detected