mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 00:50:11 +00:00
Thread: Remove some redundant functions
This commit is contained in:
parent
26f1524053
commit
1d1a55e63d
@ -49,21 +49,6 @@ Thread* GetCurrentThread() {
|
|||||||
return current_thread;
|
return current_thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the current thread
|
|
||||||
inline void SetCurrentThread(Thread* t) {
|
|
||||||
current_thread = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Saves the current CPU context
|
|
||||||
void SaveContext(Core::ThreadContext& ctx) {
|
|
||||||
Core::g_app_core->SaveContext(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Loads a CPU context
|
|
||||||
void LoadContext(Core::ThreadContext& ctx) {
|
|
||||||
Core::g_app_core->LoadContext(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resets a thread
|
/// Resets a thread
|
||||||
void ResetThread(Thread* t, u32 arg, s32 lowest_priority) {
|
void ResetThread(Thread* t, u32 arg, s32 lowest_priority) {
|
||||||
memset(&t->context, 0, sizeof(Core::ThreadContext));
|
memset(&t->context, 0, sizeof(Core::ThreadContext));
|
||||||
@ -203,7 +188,7 @@ void SwitchContext(Thread* t) {
|
|||||||
|
|
||||||
// Save context for current thread
|
// Save context for current thread
|
||||||
if (cur) {
|
if (cur) {
|
||||||
SaveContext(cur->context);
|
Core::g_app_core->SaveContext(cur->context);
|
||||||
|
|
||||||
if (cur->IsRunning()) {
|
if (cur->IsRunning()) {
|
||||||
ChangeReadyState(cur, true);
|
ChangeReadyState(cur, true);
|
||||||
@ -211,13 +196,13 @@ void SwitchContext(Thread* t) {
|
|||||||
}
|
}
|
||||||
// Load context of new thread
|
// Load context of new thread
|
||||||
if (t) {
|
if (t) {
|
||||||
SetCurrentThread(t);
|
current_thread = t;
|
||||||
ChangeReadyState(t, false);
|
ChangeReadyState(t, false);
|
||||||
t->status = (t->status | THREADSTATUS_RUNNING) & ~THREADSTATUS_READY;
|
t->status = (t->status | THREADSTATUS_RUNNING) & ~THREADSTATUS_READY;
|
||||||
t->wait_type = WAITTYPE_NONE;
|
t->wait_type = WAITTYPE_NONE;
|
||||||
LoadContext(t->context);
|
Core::g_app_core->LoadContext(t->context);
|
||||||
} else {
|
} else {
|
||||||
SetCurrentThread(nullptr);
|
current_thread = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,9 +358,9 @@ Thread* SetupMainThread(s32 priority, int stack_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run new "main" thread
|
// Run new "main" thread
|
||||||
SetCurrentThread(thread);
|
current_thread = thread;
|
||||||
thread->status = THREADSTATUS_RUNNING;
|
thread->status = THREADSTATUS_RUNNING;
|
||||||
LoadContext(thread->context);
|
Core::g_app_core->LoadContext(thread->context);
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user