forked from suyu/suyu
Add CondVar Thread State.
This commit is contained in:
parent
774f139e65
commit
acbdfdae64
5 changed files with 10 additions and 4 deletions
|
@ -62,7 +62,7 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] int cycles_
|
||||||
|
|
||||||
if (thread->GetMutexWaitAddress() != 0 || thread->GetCondVarWaitAddress() != 0 ||
|
if (thread->GetMutexWaitAddress() != 0 || thread->GetCondVarWaitAddress() != 0 ||
|
||||||
thread->GetWaitHandle() != 0) {
|
thread->GetWaitHandle() != 0) {
|
||||||
ASSERT(thread->GetStatus() == ThreadStatus::WaitMutex);
|
ASSERT(thread->GetStatus() == ThreadStatus::WaitMutex || thread->GetStatus() == ThreadStatus::WaitCondVar);
|
||||||
thread->SetMutexWaitAddress(0);
|
thread->SetMutexWaitAddress(0);
|
||||||
thread->SetCondVarWaitAddress(0);
|
thread->SetCondVarWaitAddress(0);
|
||||||
thread->SetWaitHandle(0);
|
thread->SetWaitHandle(0);
|
||||||
|
|
|
@ -1350,7 +1350,7 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var
|
||||||
current_thread->SetCondVarWaitAddress(condition_variable_addr);
|
current_thread->SetCondVarWaitAddress(condition_variable_addr);
|
||||||
current_thread->SetMutexWaitAddress(mutex_addr);
|
current_thread->SetMutexWaitAddress(mutex_addr);
|
||||||
current_thread->SetWaitHandle(thread_handle);
|
current_thread->SetWaitHandle(thread_handle);
|
||||||
current_thread->SetStatus(ThreadStatus::WaitMutex);
|
current_thread->SetStatus(ThreadStatus::WaitCondVar);
|
||||||
current_thread->InvalidateWakeupCallback();
|
current_thread->InvalidateWakeupCallback();
|
||||||
|
|
||||||
current_thread->WakeAfterDelay(nano_seconds);
|
current_thread->WakeAfterDelay(nano_seconds);
|
||||||
|
@ -1456,7 +1456,7 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target
|
||||||
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
||||||
auto owner = handle_table.Get<Thread>(owner_handle);
|
auto owner = handle_table.Get<Thread>(owner_handle);
|
||||||
ASSERT(owner);
|
ASSERT(owner);
|
||||||
ASSERT(thread->GetStatus() == ThreadStatus::WaitMutex);
|
ASSERT(thread->GetStatus() == ThreadStatus::WaitCondVar);
|
||||||
thread->InvalidateWakeupCallback();
|
thread->InvalidateWakeupCallback();
|
||||||
|
|
||||||
owner->AddMutexWaiter(thread);
|
owner->AddMutexWaiter(thread);
|
||||||
|
|
|
@ -105,6 +105,7 @@ void Thread::ResumeFromWait() {
|
||||||
case ThreadStatus::WaitSleep:
|
case ThreadStatus::WaitSleep:
|
||||||
case ThreadStatus::WaitIPC:
|
case ThreadStatus::WaitIPC:
|
||||||
case ThreadStatus::WaitMutex:
|
case ThreadStatus::WaitMutex:
|
||||||
|
case ThreadStatus::WaitCondVar:
|
||||||
case ThreadStatus::WaitArb:
|
case ThreadStatus::WaitArb:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,8 @@ enum class ThreadStatus {
|
||||||
WaitIPC, ///< Waiting for the reply from an IPC request
|
WaitIPC, ///< Waiting for the reply from an IPC request
|
||||||
WaitSynchAny, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false
|
WaitSynchAny, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false
|
||||||
WaitSynchAll, ///< Waiting due to WaitSynchronizationN with wait_all = true
|
WaitSynchAll, ///< Waiting due to WaitSynchronizationN with wait_all = true
|
||||||
WaitMutex, ///< Waiting due to an ArbitrateLock/WaitProcessWideKey svc
|
WaitMutex, ///< Waiting due to an ArbitrateLock svc
|
||||||
|
WaitCondVar, ///< Waiting due to an WaitProcessWideKey svc
|
||||||
WaitArb, ///< Waiting due to a SignalToAddress/WaitForAddress svc
|
WaitArb, ///< Waiting due to a SignalToAddress/WaitForAddress svc
|
||||||
Dormant, ///< Created but not yet made ready
|
Dormant, ///< Created but not yet made ready
|
||||||
Dead ///< Run to completion, or forcefully terminated
|
Dead ///< Run to completion, or forcefully terminated
|
||||||
|
|
|
@ -234,6 +234,9 @@ QString WaitTreeThread::GetText() const {
|
||||||
case Kernel::ThreadStatus::WaitMutex:
|
case Kernel::ThreadStatus::WaitMutex:
|
||||||
status = tr("waiting for mutex");
|
status = tr("waiting for mutex");
|
||||||
break;
|
break;
|
||||||
|
case Kernel::ThreadStatus::WaitCondVar:
|
||||||
|
status = tr("waiting for condition variable");
|
||||||
|
break;
|
||||||
case Kernel::ThreadStatus::WaitArb:
|
case Kernel::ThreadStatus::WaitArb:
|
||||||
status = tr("waiting for address arbiter");
|
status = tr("waiting for address arbiter");
|
||||||
break;
|
break;
|
||||||
|
@ -269,6 +272,7 @@ QColor WaitTreeThread::GetColor() const {
|
||||||
case Kernel::ThreadStatus::WaitSynchAll:
|
case Kernel::ThreadStatus::WaitSynchAll:
|
||||||
case Kernel::ThreadStatus::WaitSynchAny:
|
case Kernel::ThreadStatus::WaitSynchAny:
|
||||||
case Kernel::ThreadStatus::WaitMutex:
|
case Kernel::ThreadStatus::WaitMutex:
|
||||||
|
case Kernel::ThreadStatus::WaitCondVar:
|
||||||
case Kernel::ThreadStatus::WaitArb:
|
case Kernel::ThreadStatus::WaitArb:
|
||||||
return QColor(Qt::GlobalColor::red);
|
return QColor(Qt::GlobalColor::red);
|
||||||
case Kernel::ThreadStatus::Dormant:
|
case Kernel::ThreadStatus::Dormant:
|
||||||
|
|
Loading…
Reference in a new issue