Browse Source
Merge pull request #3130 from FernandoS27/cancel-sync
Kernel: Correct Cancel Synchronization.
pull/15/merge
bunnei
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
19 additions and
2 deletions
-
src/core/hle/kernel/svc.cpp
-
src/core/hle/kernel/thread.cpp
-
src/core/hle/kernel/thread.h
|
|
|
@ -505,6 +505,11 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr |
|
|
|
return RESULT_TIMEOUT; |
|
|
|
} |
|
|
|
|
|
|
|
if (thread->IsSyncCancelled()) { |
|
|
|
thread->SetSyncCancelled(false); |
|
|
|
return ERR_SYNCHRONIZATION_CANCELED; |
|
|
|
} |
|
|
|
|
|
|
|
for (auto& object : objects) { |
|
|
|
object->AddWaitingThread(thread); |
|
|
|
} |
|
|
|
|
|
|
|
@ -120,8 +120,11 @@ void Thread::ResumeFromWait() { |
|
|
|
} |
|
|
|
|
|
|
|
void Thread::CancelWait() { |
|
|
|
ASSERT(GetStatus() == ThreadStatus::WaitSynch); |
|
|
|
ClearWaitObjects(); |
|
|
|
if (GetSchedulingStatus() != ThreadSchedStatus::Paused) { |
|
|
|
is_sync_cancelled = true; |
|
|
|
return; |
|
|
|
} |
|
|
|
is_sync_cancelled = false; |
|
|
|
SetWaitSynchronizationResult(ERR_SYNCHRONIZATION_CANCELED); |
|
|
|
ResumeFromWait(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -440,6 +440,14 @@ public: |
|
|
|
is_running = value; |
|
|
|
} |
|
|
|
|
|
|
|
bool IsSyncCancelled() const { |
|
|
|
return is_sync_cancelled; |
|
|
|
} |
|
|
|
|
|
|
|
void SetSyncCancelled(bool value) { |
|
|
|
is_sync_cancelled = value; |
|
|
|
} |
|
|
|
|
|
|
|
private: |
|
|
|
explicit Thread(KernelCore& kernel); |
|
|
|
~Thread() override; |
|
|
|
@ -524,6 +532,7 @@ private: |
|
|
|
|
|
|
|
u32 scheduling_state = 0; |
|
|
|
bool is_running = false; |
|
|
|
bool is_sync_cancelled = false; |
|
|
|
|
|
|
|
std::string name; |
|
|
|
}; |
|
|
|
|