MCPcopy Create free account
hub / github.com/cemu-project/Cemu / __OSDeactivateThread

Function __OSDeactivateThread

src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp:136–163  ·  view source on GitHub ↗

remove thread from active queue. Reset id and state

Source from the content-addressed store, hash-verified

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 {

Callers 5

OSRunThreadFunction · 0.85
OSExitThreadFunction · 0.85
OSDetachThreadFunction · 0.85
OSJoinThreadFunction · 0.85

Calls 7

cemu_assert_debugFunction · 0.85
__OSHasSchedulerLockFunction · 0.85
__OSDeleteHostThreadFunction · 0.85
removeThreadMethod · 0.80
LockWriteMethod · 0.45
UnlockWriteMethod · 0.45

Tested by

no test coverage detected