diff options
| author | 2019-04-24 22:56:08 -0400 | |
|---|---|---|
| committer | 2019-04-24 22:56:08 -0400 | |
| commit | 78574e7a470a29e7ef0c1cc062d334d133c60830 (patch) | |
| tree | 9027d3466f0f588c5f14af0e23c7f7b128c79330 /src/core/hle/kernel/svc.cpp | |
| parent | Merge pull request #2424 from FernandoS27/compat (diff) | |
| parent | kernel/thread: Unify wait synchronization types (diff) | |
| download | yuzu-78574e7a470a29e7ef0c1cc062d334d133c60830.tar.gz yuzu-78574e7a470a29e7ef0c1cc062d334d133c60830.tar.xz yuzu-78574e7a470a29e7ef0c1cc062d334d133c60830.zip | |
Merge pull request #2416 from lioncash/wait
kernel/svc: Clean up wait synchronization related functionality
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 4c763b288..2dcf174c5 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -424,7 +424,7 @@ static ResultCode GetProcessId(Core::System& system, u64* process_id, Handle han | |||
| 424 | /// Default thread wakeup callback for WaitSynchronization | 424 | /// Default thread wakeup callback for WaitSynchronization |
| 425 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> thread, | 425 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> thread, |
| 426 | SharedPtr<WaitObject> object, std::size_t index) { | 426 | SharedPtr<WaitObject> object, std::size_t index) { |
| 427 | ASSERT(thread->GetStatus() == ThreadStatus::WaitSynchAny); | 427 | ASSERT(thread->GetStatus() == ThreadStatus::WaitSynch); |
| 428 | 428 | ||
| 429 | if (reason == ThreadWakeupReason::Timeout) { | 429 | if (reason == ThreadWakeupReason::Timeout) { |
| 430 | thread->SetWaitSynchronizationResult(RESULT_TIMEOUT); | 430 | thread->SetWaitSynchronizationResult(RESULT_TIMEOUT); |
| @@ -502,7 +502,7 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr | |||
| 502 | } | 502 | } |
| 503 | 503 | ||
| 504 | thread->SetWaitObjects(std::move(objects)); | 504 | thread->SetWaitObjects(std::move(objects)); |
| 505 | thread->SetStatus(ThreadStatus::WaitSynchAny); | 505 | thread->SetStatus(ThreadStatus::WaitSynch); |
| 506 | 506 | ||
| 507 | // Create an event to wake the thread up after the specified nanosecond delay has passed | 507 | // Create an event to wake the thread up after the specified nanosecond delay has passed |
| 508 | thread->WakeAfterDelay(nano_seconds); | 508 | thread->WakeAfterDelay(nano_seconds); |
| @@ -518,16 +518,14 @@ static ResultCode CancelSynchronization(Core::System& system, Handle thread_hand | |||
| 518 | LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); | 518 | LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); |
| 519 | 519 | ||
| 520 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 520 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 521 | const SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle); | 521 | SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle); |
| 522 | if (!thread) { | 522 | if (!thread) { |
| 523 | LOG_ERROR(Kernel_SVC, "Thread handle does not exist, thread_handle=0x{:08X}", | 523 | LOG_ERROR(Kernel_SVC, "Thread handle does not exist, thread_handle=0x{:08X}", |
| 524 | thread_handle); | 524 | thread_handle); |
| 525 | return ERR_INVALID_HANDLE; | 525 | return ERR_INVALID_HANDLE; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | ASSERT(thread->GetStatus() == ThreadStatus::WaitSynchAny); | 528 | thread->CancelWait(); |
| 529 | thread->SetWaitSynchronizationResult(ERR_SYNCHRONIZATION_CANCELED); | ||
| 530 | thread->ResumeFromWait(); | ||
| 531 | return RESULT_SUCCESS; | 529 | return RESULT_SUCCESS; |
| 532 | } | 530 | } |
| 533 | 531 | ||