summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-12-17 20:34:48 +0100
committerGitHub <noreply@github.com>2016-12-17 20:34:48 +0100
commit20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab (patch)
tree61df2f8ed57ff935c1ac018a64f86d683df45c1e /src/core/hle/kernel/thread.cpp
parentMerge pull request #2335 from yuriks/shader-refactor (diff)
parentThread: remove the thread from the thread list when exiting (diff)
downloadyuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.tar
yuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.tar.gz
yuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.tar.bz2
yuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.tar.lz
yuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.tar.xz
yuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.tar.zst
yuzu-20b832cfc1cb7fca6dd59a4af2f2c95e3c5eaaab.zip
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 4bbc08516..18b696f72 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -46,7 +46,7 @@ static std::vector<SharedPtr<Thread>> thread_list;
// Lists only ready thread ids.
static Common::ThreadQueueList<Thread*, THREADPRIO_LOWEST + 1> ready_queue;
-static Thread* current_thread;
+static SharedPtr<Thread> current_thread;
// The first available thread id at startup
static u32 next_thread_id;
@@ -63,7 +63,7 @@ Thread::Thread() {}
Thread::~Thread() {}
Thread* GetCurrentThread() {
- return current_thread;
+ return current_thread.get();
}
/**
@@ -263,6 +263,13 @@ void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) {
thread->status = THREADSTATUS_WAIT_ARB;
}
+void ExitCurrentThread() {
+ Thread* thread = GetCurrentThread();
+ thread->Stop();
+ thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread),
+ thread_list.end());
+}
+
/**
* Callback that will wake up the thread it was scheduled for
* @param thread_handle The handle of the thread that's been awoken