Add threadDetach function
This commit is contained in:
parent
492fffd445
commit
ce743f1b04
@ -65,6 +65,12 @@ void threadFree(Thread thread);
|
||||
*/
|
||||
Result threadJoin(Thread thread, u64 timeout_ns);
|
||||
|
||||
/**
|
||||
* @brief Changes a thread's status from attached to detached.
|
||||
* @param thread libctru thread handle
|
||||
*/
|
||||
void threadDetach(Thread thread);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the libctru thread handle of the current thread.
|
||||
* @return libctru thread handle of the current thread, or NULL for the main thread
|
||||
|
@ -107,6 +107,19 @@ Result threadJoin(Thread thread, u64 timeout_ns)
|
||||
return svcWaitSynchronization(thread->handle, timeout_ns);
|
||||
}
|
||||
|
||||
void threadDetach(Thread thread)
|
||||
{
|
||||
if (!thread || thread->detached)
|
||||
return;
|
||||
if (thread->finished)
|
||||
{
|
||||
threadFree(thread);
|
||||
return;
|
||||
}
|
||||
thread->detached = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Thread threadGetCurrent(void)
|
||||
{
|
||||
ThreadVars* tv = getThreadVars();
|
||||
|
Loading…
Reference in New Issue
Block a user