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.
This commit is contained in:
@ -17,7 +17,7 @@ namespace Kernel {
|
||||
|
||||
void AddressArbiter::WaitThread(SharedPtr<Thread> thread, VAddr wait_address) {
|
||||
thread->wait_address = wait_address;
|
||||
thread->status = THREADSTATUS_WAIT_ARB;
|
||||
thread->status = ThreadStatus::WaitArb;
|
||||
waiting_threads.emplace_back(std::move(thread));
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ void AddressArbiter::ResumeAllThreads(VAddr address) {
|
||||
// Determine which threads are waiting on this address, those should be woken up.
|
||||
auto itr = std::stable_partition(waiting_threads.begin(), waiting_threads.end(),
|
||||
[address](const auto& thread) {
|
||||
ASSERT_MSG(thread->status == THREADSTATUS_WAIT_ARB,
|
||||
ASSERT_MSG(thread->status == ThreadStatus::WaitArb,
|
||||
"Inconsistent AddressArbiter state");
|
||||
return thread->wait_address != address;
|
||||
});
|
||||
@ -41,8 +41,7 @@ SharedPtr<Thread> AddressArbiter::ResumeHighestPriorityThread(VAddr address) {
|
||||
// Determine which threads are waiting on this address, those should be considered for wakeup.
|
||||
auto matches_start = std::stable_partition(
|
||||
waiting_threads.begin(), waiting_threads.end(), [address](const auto& thread) {
|
||||
ASSERT_MSG(thread->status == THREADSTATUS_WAIT_ARB,
|
||||
"Inconsistent AddressArbiter state");
|
||||
ASSERT_MSG(thread->status == ThreadStatus::WaitArb, "Inconsistent AddressArbiter state");
|
||||
return thread->wait_address != address;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user