forked from ShuriZma/suyu
SCC: Small corrections to CancelSynchronization
This commit is contained in:
parent
44cb9997b3
commit
a66c61ca2d
|
@ -74,7 +74,9 @@ std::pair<ResultCode, Handle> Synchronization::WaitFor(
|
||||||
thread->SetSynchronizationObjects(&sync_objects);
|
thread->SetSynchronizationObjects(&sync_objects);
|
||||||
thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT);
|
thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT);
|
||||||
thread->SetStatus(ThreadStatus::WaitSynch);
|
thread->SetStatus(ThreadStatus::WaitSynch);
|
||||||
|
thread->SetWaitingSync(true);
|
||||||
}
|
}
|
||||||
|
thread->SetWaitingSync(false);
|
||||||
|
|
||||||
if (event_handle != InvalidHandle) {
|
if (event_handle != InvalidHandle) {
|
||||||
auto& time_manager = kernel.TimeManager();
|
auto& time_manager = kernel.TimeManager();
|
||||||
|
|
|
@ -139,13 +139,14 @@ ResultCode Thread::Start() {
|
||||||
|
|
||||||
void Thread::CancelWait() {
|
void Thread::CancelWait() {
|
||||||
SchedulerLock lock(kernel);
|
SchedulerLock lock(kernel);
|
||||||
if (GetSchedulingStatus() != ThreadSchedStatus::Paused) {
|
if (GetSchedulingStatus() != ThreadSchedStatus::Paused || !is_waiting_on_sync) {
|
||||||
is_sync_cancelled = true;
|
is_sync_cancelled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//TODO(Blinkhawk): Implement cancel of server session
|
||||||
is_sync_cancelled = false;
|
is_sync_cancelled = false;
|
||||||
SetSynchronizationResults(nullptr, ERR_SYNCHRONIZATION_CANCELED);
|
SetSynchronizationResults(nullptr, ERR_SYNCHRONIZATION_CANCELED);
|
||||||
ResumeFromWait();
|
SetStatus(ThreadStatus::Ready);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetThreadContext32(Core::ARM_Interface::ThreadContext32& context, u32 stack_top,
|
static void ResetThreadContext32(Core::ARM_Interface::ThreadContext32& context, u32 stack_top,
|
||||||
|
|
|
@ -556,6 +556,14 @@ public:
|
||||||
waiting_for_arbitration = set;
|
waiting_for_arbitration = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsWaitingSync() const {
|
||||||
|
return is_waiting_on_sync;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetWaitingSync(bool is_waiting) {
|
||||||
|
is_waiting_on_sync = is_waiting;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class GlobalScheduler;
|
friend class GlobalScheduler;
|
||||||
friend class Scheduler;
|
friend class Scheduler;
|
||||||
|
@ -650,6 +658,7 @@ private:
|
||||||
|
|
||||||
u32 scheduling_state = 0;
|
u32 scheduling_state = 0;
|
||||||
bool is_running = false;
|
bool is_running = false;
|
||||||
|
bool is_waiting_on_sync = false;
|
||||||
bool is_sync_cancelled = false;
|
bool is_sync_cancelled = false;
|
||||||
|
|
||||||
bool will_be_terminated{};
|
bool will_be_terminated{};
|
||||||
|
|
Loading…
Reference in New Issue