mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-27 15:11:16 +00:00
48 lines
846 B
C++
48 lines
846 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->isSignaled;
|
|
}
|
|
|
|
KReadableEvent::~KReadableEvent()
|
|
{
|
|
}
|
|
|
|
Result KReadableEvent::Signal()
|
|
{
|
|
KScopedCriticalSection criticalSection{};
|
|
|
|
if (!this->isSignaled) {
|
|
this->isSignaled = true;
|
|
NotifyWaiters();
|
|
}
|
|
|
|
return ResultSuccess();
|
|
}
|
|
|
|
Result KReadableEvent::Clear()
|
|
{
|
|
Reset();
|
|
|
|
return ResultSuccess();
|
|
}
|
|
|
|
Result KReadableEvent::Reset()
|
|
{
|
|
KScopedCriticalSection criticalSection{};
|
|
|
|
if (this->isSignaled) {
|
|
this->isSignaled = false;
|
|
return ResultSuccess();
|
|
}
|
|
return ResultKernelInvalidState();
|
|
}
|
|
|
|
}
|