summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-07-17 07:24:13 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-07-17 07:24:13 +0200
commitdc39d06950de246094be9643313970125e0c49ee (patch)
treee7f43ef1f2ae7b8fd029bdaf6c43c2b25f5620eb /src/core/hle/kernel
parentRemove webchat link from readme (diff)
downloadyuzu-dc39d06950de246094be9643313970125e0c49ee.tar
yuzu-dc39d06950de246094be9643313970125e0c49ee.tar.gz
yuzu-dc39d06950de246094be9643313970125e0c49ee.tar.bz2
yuzu-dc39d06950de246094be9643313970125e0c49ee.tar.lz
yuzu-dc39d06950de246094be9643313970125e0c49ee.tar.xz
yuzu-dc39d06950de246094be9643313970125e0c49ee.tar.zst
yuzu-dc39d06950de246094be9643313970125e0c49ee.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/thread.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 4729a7fe0..64166ab99 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -37,6 +37,10 @@ void Thread::Acquire() {
ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
+// TODO(yuriks): This can be removed if Thread objects are explicitly pooled in the future, allowing
+// us to simply use a pool index or similar.
+static Kernel::HandleTable wakeup_callback_handle_table;
+
// Lists all thread ids that aren't deleted/etc.
static std::vector<SharedPtr<Thread>> thread_list;
@@ -93,6 +97,8 @@ void Thread::Stop() {
// Cancel any outstanding wakeup events for this thread
CoreTiming::UnscheduleEvent(ThreadWakeupEventType, callback_handle);
+ wakeup_callback_handle_table.Close(callback_handle);
+ callback_handle = 0;
// Clean up thread from ready queue
// This is only needed when the thread is termintated forcefully (SVC TerminateProcess)
@@ -108,6 +114,7 @@ void Thread::Stop() {
for (auto& wait_object : wait_objects) {
wait_object->RemoveWaitingThread(this);
}
+ wait_objects.clear();
Kernel::g_current_process->used_tls_slots[tls_index] = false;
@@ -268,10 +275,6 @@ void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) {
thread->status = THREADSTATUS_WAIT_ARB;
}
-// TODO(yuriks): This can be removed if Thread objects are explicitly pooled in the future, allowing
-// us to simply use a pool index or similar.
-static Kernel::HandleTable wakeup_callback_handle_table;
-
/**
* Callback that will wake up the thread it was scheduled for
* @param thread_handle The handle of the thread that's been awoken
@@ -503,12 +506,16 @@ void ThreadingInit() {
current_thread = nullptr;
next_thread_id = 1;
-
- thread_list.clear();
- ready_queue.clear();
}
void ThreadingShutdown() {
+ current_thread = nullptr;
+
+ for (auto& t : thread_list) {
+ t->Stop();
+ }
+ thread_list.clear();
+ ready_queue.clear();
}
} // namespace