summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar wwylele2016-12-17 13:08:38 +0200
committerGravatar wwylele2016-12-17 19:23:52 +0200
commit5728e42634740463ba2da4758d817ad09a84dc60 (patch)
tree61df2f8ed57ff935c1ac018a64f86d683df45c1e /src/core/hle/kernel/thread.cpp
parentMerge pull request #2335 from yuriks/shader-refactor (diff)
downloadyuzu-5728e42634740463ba2da4758d817ad09a84dc60.tar.gz
yuzu-5728e42634740463ba2da4758d817ad09a84dc60.tar.xz
yuzu-5728e42634740463ba2da4758d817ad09a84dc60.zip
Thread: remove the thread from the thread list when exiting
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;
46// Lists only ready thread ids. 46// Lists only ready thread ids.
47static Common::ThreadQueueList<Thread*, THREADPRIO_LOWEST + 1> ready_queue; 47static Common::ThreadQueueList<Thread*, THREADPRIO_LOWEST + 1> ready_queue;
48 48
49static Thread* current_thread; 49static SharedPtr<Thread> current_thread;
50 50
51// The first available thread id at startup 51// The first available thread id at startup
52static u32 next_thread_id; 52static u32 next_thread_id;
@@ -63,7 +63,7 @@ Thread::Thread() {}
63Thread::~Thread() {} 63Thread::~Thread() {}
64 64
65Thread* GetCurrentThread() { 65Thread* GetCurrentThread() {
66 return current_thread; 66 return current_thread.get();
67} 67}
68 68
69/** 69/**
@@ -263,6 +263,13 @@ void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) {
263 thread->status = THREADSTATUS_WAIT_ARB; 263 thread->status = THREADSTATUS_WAIT_ARB;
264} 264}
265 265
266void ExitCurrentThread() {
267 Thread* thread = GetCurrentThread();
268 thread->Stop();
269 thread_list.erase(std::remove(thread_list.begin(), thread_list.end(), thread),
270 thread_list.end());
271}
272
266/** 273/**
267 * Callback that will wake up the thread it was scheduled for 274 * Callback that will wake up the thread it was scheduled for
268 * @param thread_handle The handle of the thread that's been awoken 275 * @param thread_handle The handle of the thread that's been awoken