Ejemplo n.º 1
0
ResultVal<s32> Semaphore::Release(s32 release_count) {
    if (max_count - available_count < release_count)
        return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Kernel,
                          ErrorSummary::InvalidArgument, ErrorLevel::Permanent);

    s32 previous_count = available_count;
    available_count += release_count;

    // Notify some of the threads that the semaphore has been released
    // stop once the semaphore is full again or there are no more waiting threads
    while (!ShouldWait() && WakeupNextThread() != nullptr) {
        Acquire();
    }

    return MakeResult<s32>(previous_count);
}
Ejemplo n.º 2
0
void Thread::Acquire() {
    ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
Ejemplo n.º 3
0
void Event::Acquire(Thread* thread) {
    ASSERT_MSG(!ShouldWait(thread), "object unavailable!");

    if (reset_type == ResetType::OneShot)
        signaled = false;
}
Ejemplo n.º 4
0
void Semaphore::Acquire() {
    ASSERT_MSG(!ShouldWait(), "object unavailable!");
    --available_count;
}
Ejemplo n.º 5
0
void ServerPort::Acquire(Thread* thread) {
    ASSERT_MSG(!ShouldWait(thread), "object unavailable!");
}
Ejemplo n.º 6
0
void ServerPort::Acquire() {
    ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
Ejemplo n.º 7
0
void Timer::Acquire() {
    ASSERT_MSG(!ShouldWait(), "object unavailable!");

    if (reset_type == ResetType::OneShot)
        signaled = false;
}
Ejemplo n.º 8
0
 void Acquire() override {
     _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
     --available_count;
 }