MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / exit

Method exit

3ds/source/thread.cpp:194–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void Threads::exit(void)
195{
196 // Idempotent: called explicitly at the end of main (so every worker is joined
197 // before exit() runs static destructors) and again via atexit as a backstop
198 // for early-error exits that never reach the explicit call.
199 static std::atomic<bool> alreadyExited{false};
200 if (alreadyExited.exchange(true)) {
201 return;
202 }
203 workerTasks.lock()->clear();
204 LightSemaphore_Release(&moreTasks, numWorkers);
205 svcSignalEvent(threads.lock()->second[0]);
206 threadJoin(reaperThread, U64_MAX);
207 threadFree(reaperThread);
208 svcCloseHandle(threads.lock()->second[0]);
209 svcCloseHandle(threads.lock()->second[1]);
210}

Callers

nothing calls this directly

Calls 2

clearMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected