Kernel: Refactor synchronization to better match RE

This commit is contained in:
Fernando Sahmkow
2020-02-11 17:36:39 -04:00
committed by FernandoS27
parent c5aefe42aa
commit d23d504d77
23 changed files with 212 additions and 80 deletions

View File

@ -50,6 +50,16 @@ bool ServerSession::ShouldWait(const Thread* thread) const {
return pending_requesting_threads.empty() || currently_handling != nullptr;
}
bool ServerSession::IsSignaled() const {
// Closed sessions should never wait, an error will be returned from svcReplyAndReceive.
if (!parent->Client()) {
return true;
}
// Wait if we have no pending requests, or if we're currently handling a request.
return !(pending_requesting_threads.empty() || currently_handling != nullptr);
}
void ServerSession::Acquire(Thread* thread) {
ASSERT_MSG(!ShouldWait(thread), "object unavailable!");
// We are now handling a request, pop it from the stack.