summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/mutex.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-07-19 21:39:05 -0400
committerGravatar Lioncash2018-07-19 22:08:56 -0400
commitdbfe82773d98fadac481cd9061f5eda98aebf308 (patch)
treeee1c5f480bcbf95339eff8677f061bbb57d8ee95 /src/core/hle/kernel/mutex.cpp
parentMerge pull request #726 from lioncash/overload (diff)
downloadyuzu-dbfe82773d98fadac481cd9061f5eda98aebf308.tar.gz
yuzu-dbfe82773d98fadac481cd9061f5eda98aebf308.tar.xz
yuzu-dbfe82773d98fadac481cd9061f5eda98aebf308.zip
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/core/hle/kernel/mutex.cpp')
-rw-r--r--src/core/hle/kernel/mutex.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 65560226d..3f1de3258 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -28,7 +28,7 @@ static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread(
28 if (thread->mutex_wait_address != mutex_addr) 28 if (thread->mutex_wait_address != mutex_addr)
29 continue; 29 continue;
30 30
31 ASSERT(thread->status == THREADSTATUS_WAIT_MUTEX); 31 ASSERT(thread->status == ThreadStatus::WaitMutex);
32 32
33 ++num_waiters; 33 ++num_waiters;
34 if (highest_priority_thread == nullptr || 34 if (highest_priority_thread == nullptr ||
@@ -83,7 +83,7 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle,
83 GetCurrentThread()->mutex_wait_address = address; 83 GetCurrentThread()->mutex_wait_address = address;
84 GetCurrentThread()->wait_handle = requesting_thread_handle; 84 GetCurrentThread()->wait_handle = requesting_thread_handle;
85 85
86 GetCurrentThread()->status = THREADSTATUS_WAIT_MUTEX; 86 GetCurrentThread()->status = ThreadStatus::WaitMutex;
87 GetCurrentThread()->wakeup_callback = nullptr; 87 GetCurrentThread()->wakeup_callback = nullptr;
88 88
89 // Update the lock holder thread's priority to prevent priority inversion. 89 // Update the lock holder thread's priority to prevent priority inversion.
@@ -121,7 +121,7 @@ ResultCode Mutex::Release(VAddr address) {
121 // Grant the mutex to the next waiting thread and resume it. 121 // Grant the mutex to the next waiting thread and resume it.
122 Memory::Write32(address, mutex_value); 122 Memory::Write32(address, mutex_value);
123 123
124 ASSERT(thread->status == THREADSTATUS_WAIT_MUTEX); 124 ASSERT(thread->status == ThreadStatus::WaitMutex);
125 thread->ResumeFromWait(); 125 thread->ResumeFromWait();
126 126
127 thread->lock_owner = nullptr; 127 thread->lock_owner = nullptr;