mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 19:00:06 +00:00
thread: removed unused SwitchContext/Reschedule reason field, added missing arg parameter to SVC CreateThread
This commit is contained in:
parent
d26f3d4c1f
commit
7c0b006076
@ -147,7 +147,7 @@ void CallThread(Thread* t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Switches CPU context to that of the specified thread
|
/// Switches CPU context to that of the specified thread
|
||||||
void SwitchContext(Thread* t, const char* reason) {
|
void SwitchContext(Thread* t) {
|
||||||
Thread* cur = GetCurrentThread();
|
Thread* cur = GetCurrentThread();
|
||||||
|
|
||||||
// Save context for current thread
|
// Save context for current thread
|
||||||
@ -299,11 +299,11 @@ Handle SetupMainThread(s32 priority, int stack_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reschedules to the next available thread (call after current thread is suspended)
|
/// Reschedules to the next available thread (call after current thread is suspended)
|
||||||
void Reschedule(const char* reason) {
|
void Reschedule() {
|
||||||
Thread* prev = GetCurrentThread();
|
Thread* prev = GetCurrentThread();
|
||||||
Thread* next = NextThread();
|
Thread* next = NextThread();
|
||||||
if (next > 0) {
|
if (next > 0) {
|
||||||
SwitchContext(next, reason);
|
SwitchContext(next);
|
||||||
|
|
||||||
// Hack - automatically change previous thread (which would have been in "wait" state) to
|
// Hack - automatically change previous thread (which would have been in "wait" state) to
|
||||||
// "ready" state, so that we can immediately resume to it when new thread yields. FixMe to
|
// "ready" state, so that we can immediately resume to it when new thread yields. FixMe to
|
||||||
|
@ -51,7 +51,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
|
|||||||
Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE);
|
Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
/// Reschedules to the next available thread (call after current thread is suspended)
|
/// Reschedules to the next available thread (call after current thread is suspended)
|
||||||
void Reschedule(const char* reason);
|
void Reschedule();
|
||||||
|
|
||||||
/// Puts a thread in the wait state for the given type/reason
|
/// Puts a thread in the wait state for the given type/reason
|
||||||
void WaitCurThread(WaitType wait_type, const char* reason);
|
void WaitCurThread(WaitType wait_type, const char* reason);
|
||||||
|
@ -106,10 +106,9 @@ Result CloseHandle(Handle handle) {
|
|||||||
|
|
||||||
/// Wait for a handle to synchronize, timeout after the specified nanoseconds
|
/// Wait for a handle to synchronize, timeout after the specified nanoseconds
|
||||||
Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
||||||
// ImplementMe
|
|
||||||
DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronization1 called handle=0x%08X, nanoseconds=%d",
|
DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronization1 called handle=0x%08X, nanoseconds=%d",
|
||||||
handle, nano_seconds);
|
handle, nano_seconds);
|
||||||
Kernel::Reschedule("WaitSynchronization1");
|
Kernel::WaitCurThread(WAITTYPE_SYNCH, "WaitSynchronization1"); // TODO(bunnei): Is this correct?
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +116,6 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
|||||||
Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wait_all, s64 nano_seconds) {
|
Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wait_all, s64 nano_seconds) {
|
||||||
s32* out = (s32*)_out;
|
s32* out = (s32*)_out;
|
||||||
Handle* handles = (Handle*)_handles;
|
Handle* handles = (Handle*)_handles;
|
||||||
// ImplementMe
|
|
||||||
|
|
||||||
DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronizationN called handle_count=%d, wait_all=%s, nanoseconds=%d %s",
|
DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronizationN called handle_count=%d, wait_all=%s, nanoseconds=%d %s",
|
||||||
handle_count, (wait_all ? "true" : "false"), nano_seconds);
|
handle_count, (wait_all ? "true" : "false"), nano_seconds);
|
||||||
@ -125,8 +123,7 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa
|
|||||||
for (u32 i = 0; i < handle_count; i++) {
|
for (u32 i = 0; i < handle_count; i++) {
|
||||||
DEBUG_LOG(SVC, "\thandle[%d]=0x%08X", i, handles[i]);
|
DEBUG_LOG(SVC, "\thandle[%d]=0x%08X", i, handles[i]);
|
||||||
}
|
}
|
||||||
Kernel::Reschedule("WaitSynchronizationN");
|
Kernel::WaitCurThread(WAITTYPE_SYNCH, "WaitSynchronizationN"); // TODO(bunnei): Is this correct?
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +171,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p
|
|||||||
name = buff;
|
name = buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, processor_id,
|
Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id,
|
||||||
stack_top);
|
stack_top);
|
||||||
|
|
||||||
Core::g_app_core->SetReg(1, thread);
|
Core::g_app_core->SetReg(1, thread);
|
||||||
|
Loading…
Reference in New Issue
Block a user