Improve thread code
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
#pragma once
|
||||
#include <PSX/System/threads.hpp>
|
||||
#include "threads.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace Callback {
|
||||
namespace internal {
|
||||
static void execute_thread(SysCall::ThreadHandle thread_handle) {
|
||||
MainThread::prepare_if_main(thread_handle);
|
||||
Thread::execute_next();
|
||||
static void execute_callback(Thread::Handle thread_handle) {
|
||||
if(CurrentThread::is_me(MainThread::Handle)) {
|
||||
CurrentThread::replace_with(thread_handle);
|
||||
}
|
||||
|
||||
SysCall::ReturnFromException();
|
||||
}
|
||||
|
||||
namespace VSync {
|
||||
@@ -17,7 +20,7 @@ namespace JabyEngine {
|
||||
void routine();
|
||||
|
||||
static void [[deprecated("Currently not in use")]] execute() {
|
||||
execute_thread(VSync::thread_handle);
|
||||
execute_callback(VSync::thread_handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +31,7 @@ namespace JabyEngine {
|
||||
extern uint32_t stack[StackSize];
|
||||
|
||||
static void execute() {
|
||||
execute_thread(CD::thread_handle);
|
||||
execute_callback(CD::thread_handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user