mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-23 14:25:45 +00:00
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:
parent
38a90882a4
commit
e6a7723f2f
17 changed files with 56 additions and 68 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue