unifork.old/source/utils/thread.cpp
StackZ 09be8e0b94
Switch over to Universal-Core. (#18)
* Don't build here.

* WIP: Switch to Universal-Core.

* Update Submodule repo & azure-pipelines.
2020-02-08 06:20:50 +01:00

23 lines
No EOL
518 B
C++

#include "thread.hpp"
#include <3ds.h>
#include <stdio.h>
#include <string.h>
static std::vector<Thread> threads;
void Threads::create(ThreadFunc entrypoint)
{
s32 prio = 0;
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
Thread thread = threadCreate((ThreadFunc)entrypoint, NULL, 64 * 1024, prio - 1, -2, false);
threads.push_back(thread);
}
void Threads::destroy(void)
{
for (u32 i = 0; i < threads.size(); i++) {
threadJoin(threads.at(i), U64_MAX);
threadFree(threads.at(i));
}
}