add thread to active queue
| 104 | |
| 105 | // add thread to active queue |
| 106 | void __OSActivateThread(OSThread_t* thread) |
| 107 | { |
| 108 | cemu_assert_debug(__OSHasSchedulerLock()); |
| 109 | |
| 110 | g_activeThreadQueue->addThread(thread, &thread->activeThreadChain); // todo - check if thread already in queue |
| 111 | |
| 112 | MPTR threadMPTR = memory_getVirtualOffsetFromPointer(thread); |
| 113 | |
| 114 | srwlock_activeThreadList.LockWrite(); |
| 115 | bool alreadyActive = false; |
| 116 | for (sint32 i = 0; i < activeThreadCount; i++) |
| 117 | { |
| 118 | if (activeThread[i] == threadMPTR) |
| 119 | { |
| 120 | cemu_assert_debug(false); // should not happen |
| 121 | alreadyActive = true; |
| 122 | } |
| 123 | } |
| 124 | if (alreadyActive == false) |
| 125 | { |
| 126 | activeThread[activeThreadCount] = threadMPTR; |
| 127 | activeThreadCount++; |
| 128 | } |
| 129 | |
| 130 | __OSCreateHostThread(thread); |
| 131 | |
| 132 | srwlock_activeThreadList.UnlockWrite(); |
| 133 | } |
| 134 | |
| 135 | // remove thread from active queue. Reset id and state |
| 136 | void __OSDeactivateThread(OSThread_t* thread) |
no test coverage detected