renderd7/source/Tasks.cpp

22 lines
561 B
C++
Raw Normal View History

2022-11-25 01:05:50 +01:00
#include <renderd7/Tasks.hpp>
#include <3ds.h>
#include <stdio.h>
#include <string.h>
static std::vector<Thread> threads;
2023-03-12 21:06:13 +01:00
void RenderD7::Tasks::create(ThreadFunc entrypoint) {
2022-11-25 01:05:50 +01:00
s32 prio = 0;
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
Thread thread = threadCreate((ThreadFunc)entrypoint, NULL, 64 * 1024,
prio - 1, -2, false);
threads.push_back(thread);
}
2023-03-12 21:06:13 +01:00
void RenderD7::Tasks::destroy(void) {
2022-11-25 01:05:50 +01:00
for (u32 i = 0; i < threads.size(); i++) {
threadJoin(threads.at(i), U64_MAX);
threadFree(threads.at(i));
}
}