Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.

This will be useful when implementing mutex priority inheritance.
This commit is contained in:
Subv
2017-01-01 16:53:22 -05:00
parent 38a90882a4
commit e6a7723f2f
17 changed files with 56 additions and 68 deletions

View File

@ -30,12 +30,12 @@ ResultVal<SharedPtr<Semaphore>> Semaphore::Create(s32 initial_count, s32 max_cou
return MakeResult<SharedPtr<Semaphore>>(std::move(semaphore));
}
bool Semaphore::ShouldWait() {
bool Semaphore::ShouldWait(Thread* thread) const {
return available_count <= 0;
}
void Semaphore::Acquire() {
ASSERT_MSG(!ShouldWait(), "object unavailable!");
void Semaphore::Acquire(Thread* thread) {
ASSERT_MSG(!ShouldWait(thread), "object unavailable!");
--available_count;
}