mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-25 22:21:14 +00:00
41 lines
834 B
C++
41 lines
834 B
C++
|
#include <mesosphere/processes/KWritableEvent.hpp>
|
||
|
#include <mesosphere/processes/KReadableEvent.hpp>
|
||
|
#include <mesosphere/processes/KEvent.hpp>
|
||
|
#include <mesosphere/threading/KScheduler.hpp>
|
||
|
|
||
|
namespace mesosphere
|
||
|
{
|
||
|
|
||
|
bool KReadableEvent::IsSignaled() const {
|
||
|
return this->is_signaled;
|
||
|
}
|
||
|
|
||
|
Result KReadableEvent::Signal() {
|
||
|
KScopedCriticalSection critical_section;
|
||
|
|
||
|
if (!this->is_signaled) {
|
||
|
this->is_signaled = true;
|
||
|
this->NotifyWaiters();
|
||
|
}
|
||
|
|
||
|
return ResultSuccess();
|
||
|
}
|
||
|
|
||
|
Result KReadableEvent::Clear() {
|
||
|
this->Reset();
|
||
|
|
||
|
return ResultSuccess();
|
||
|
}
|
||
|
|
||
|
Result KReadableEvent::Reset() {
|
||
|
KScopedCriticalSection critical_section;
|
||
|
|
||
|
if (this->is_signaled) {
|
||
|
this->is_signaled = false;
|
||
|
return ResultSuccess();
|
||
|
}
|
||
|
return ResultKernelInvalidState();
|
||
|
}
|
||
|
|
||
|
}
|