diff options
| author | 2020-03-03 13:02:50 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:22 -0400 | |
| commit | 75e10578f12cf64bd734388ba80b5f5a46ca6133 (patch) | |
| tree | 4ba3fa4053193e03407dbfdd6d9d742537406000 /src/core/hle/kernel/thread.cpp | |
| parent | Process: Protect TLS region and Modules. (diff) | |
| download | yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.gz yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.xz yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.zip | |
Core: Correct HLE Event Callbacks and other issues.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index a645ee3a2..16babe71a 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -47,19 +47,21 @@ Thread::Thread(KernelCore& kernel) : SynchronizationObject{kernel} {} | |||
| 47 | Thread::~Thread() = default; | 47 | Thread::~Thread() = default; |
| 48 | 48 | ||
| 49 | void Thread::Stop() { | 49 | void Thread::Stop() { |
| 50 | SchedulerLock lock(kernel); | 50 | { |
| 51 | // Cancel any outstanding wakeup events for this thread | 51 | SchedulerLock lock(kernel); |
| 52 | Signal(); | 52 | // Cancel any outstanding wakeup events for this thread |
| 53 | Core::System::GetInstance().CoreTiming().UnscheduleEvent(kernel.ThreadWakeupCallbackEventType(), | 53 | Signal(); |
| 54 | global_handle); | 54 | Core::System::GetInstance().CoreTiming().UnscheduleEvent( |
| 55 | kernel.GlobalHandleTable().Close(global_handle); | 55 | kernel.ThreadWakeupCallbackEventType(), global_handle); |
| 56 | global_handle = 0; | 56 | kernel.GlobalHandleTable().Close(global_handle); |
| 57 | SetStatus(ThreadStatus::Dead); | 57 | SetStatus(ThreadStatus::Dead); |
| 58 | 58 | ||
| 59 | owner_process->UnregisterThread(this); | 59 | owner_process->UnregisterThread(this); |
| 60 | 60 | ||
| 61 | // Mark the TLS slot in the thread's page as free. | 61 | // Mark the TLS slot in the thread's page as free. |
| 62 | owner_process->FreeTLSRegion(tls_address); | 62 | owner_process->FreeTLSRegion(tls_address); |
| 63 | } | ||
| 64 | global_handle = 0; | ||
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | void Thread::WakeAfterDelay(s64 nanoseconds) { | 67 | void Thread::WakeAfterDelay(s64 nanoseconds) { |
| @@ -112,8 +114,6 @@ void Thread::ResumeFromWait() { | |||
| 112 | return; | 114 | return; |
| 113 | } | 115 | } |
| 114 | 116 | ||
| 115 | hle_callback = nullptr; | ||
| 116 | |||
| 117 | if (activity == ThreadActivity::Paused) { | 117 | if (activity == ThreadActivity::Paused) { |
| 118 | SetStatus(ThreadStatus::Paused); | 118 | SetStatus(ThreadStatus::Paused); |
| 119 | return; | 119 | return; |
| @@ -398,14 +398,13 @@ bool Thread::AllSynchronizationObjectsReady() const { | |||
| 398 | bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | 398 | bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |
| 399 | std::shared_ptr<SynchronizationObject> object, | 399 | std::shared_ptr<SynchronizationObject> object, |
| 400 | std::size_t index) { | 400 | std::size_t index) { |
| 401 | ASSERT(hle_callback); | 401 | ASSERT(wakeup_callback); |
| 402 | return hle_callback(reason, std::move(thread), std::move(object), index); | 402 | return wakeup_callback(reason, std::move(thread), std::move(object), index); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | bool Thread::InvokeHLECallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | 405 | bool Thread::InvokeHLECallback(std::shared_ptr<Thread> thread) { |
| 406 | std::shared_ptr<SynchronizationObject> object, std::size_t index) { | ||
| 407 | ASSERT(hle_callback); | 406 | ASSERT(hle_callback); |
| 408 | return hle_callback(reason, std::move(thread), std::move(object), index); | 407 | return hle_callback(std::move(thread)); |
| 409 | } | 408 | } |
| 410 | 409 | ||
| 411 | void Thread::SetActivity(ThreadActivity value) { | 410 | void Thread::SetActivity(ThreadActivity value) { |