diff options
author | Lioncash <mathew1800@gmail.com> | 2018-07-19 21:39:05 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-07-19 22:08:56 -0400 |
commit | dbfe82773d98fadac481cd9061f5eda98aebf308 (patch) | |
tree | ee1c5f480bcbf95339eff8677f061bbb57d8ee95 /src/yuzu | |
parent | d3cfaf95c883512691df01e90d8ab7e8873c2c3d (diff) |
thread: Convert ThreadStatus into an enum class
Makes the thread status strongly typed, so implicit conversions can't
happen. It also makes it easier to catch mistakes at compile time.
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/debugger/wait_tree.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp index 7101b381e..8f24586ce 100644 --- a/src/yuzu/debugger/wait_tree.cpp +++ b/src/yuzu/debugger/wait_tree.cpp @@ -194,32 +194,32 @@ QString WaitTreeThread::GetText() const { const auto& thread = static_cast<const Kernel::Thread&>(object); QString status; switch (thread.status) { - case THREADSTATUS_RUNNING: + case ThreadStatus::Running: status = tr("running"); break; - case THREADSTATUS_READY: + case ThreadStatus::Ready: status = tr("ready"); break; - case THREADSTATUS_WAIT_HLE_EVENT: + case ThreadStatus::WaitHLEEvent: status = tr("waiting for HLE return"); break; - case THREADSTATUS_WAIT_SLEEP: + case ThreadStatus::WaitSleep: status = tr("sleeping"); break; - case THREADSTATUS_WAIT_SYNCH_ALL: - case THREADSTATUS_WAIT_SYNCH_ANY: + case ThreadStatus::WaitSynchAll: + case ThreadStatus::WaitSynchAny: status = tr("waiting for objects"); break; - case THREADSTATUS_WAIT_MUTEX: + case ThreadStatus::WaitMutex: status = tr("waiting for mutex"); break; - case THREADSTATUS_WAIT_ARB: + case ThreadStatus::WaitArb: status = tr("waiting for address arbiter"); break; - case THREADSTATUS_DORMANT: + case ThreadStatus::Dormant: status = tr("dormant"); break; - case THREADSTATUS_DEAD: + case ThreadStatus::Dead: status = tr("dead"); break; } @@ -232,22 +232,22 @@ QString WaitTreeThread::GetText() const { QColor WaitTreeThread::GetColor() const { const auto& thread = static_cast<const Kernel::Thread&>(object); switch (thread.status) { - case THREADSTATUS_RUNNING: + case ThreadStatus::Running: return QColor(Qt::GlobalColor::darkGreen); - case THREADSTATUS_READY: + case ThreadStatus::Ready: return QColor(Qt::GlobalColor::darkBlue); - case THREADSTATUS_WAIT_HLE_EVENT: + case ThreadStatus::WaitHLEEvent: return QColor(Qt::GlobalColor::darkRed); - case THREADSTATUS_WAIT_SLEEP: + case ThreadStatus::WaitSleep: return QColor(Qt::GlobalColor::darkYellow); - case THREADSTATUS_WAIT_SYNCH_ALL: - case THREADSTATUS_WAIT_SYNCH_ANY: - case THREADSTATUS_WAIT_MUTEX: - case THREADSTATUS_WAIT_ARB: + case ThreadStatus::WaitSynchAll: + case ThreadStatus::WaitSynchAny: + case ThreadStatus::WaitMutex: + case ThreadStatus::WaitArb: return QColor(Qt::GlobalColor::red); - case THREADSTATUS_DORMANT: + case ThreadStatus::Dormant: return QColor(Qt::GlobalColor::darkCyan); - case THREADSTATUS_DEAD: + case ThreadStatus::Dead: return QColor(Qt::GlobalColor::gray); default: return WaitTreeItem::GetColor(); @@ -291,8 +291,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { else list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex"))); - if (thread.status == THREADSTATUS_WAIT_SYNCH_ANY || - thread.status == THREADSTATUS_WAIT_SYNCH_ALL) { + if (thread.status == ThreadStatus::WaitSynchAny || + thread.status == ThreadStatus::WaitSynchAll) { list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects, thread.IsSleepingOnWaitAll())); } |