2018-11-05 03:51:50 -08:00
|
|
|
#include <mesosphere/processes/KWritableEvent.hpp>
|
|
|
|
#include <mesosphere/processes/KReadableEvent.hpp>
|
|
|
|
#include <mesosphere/processes/KEvent.hpp>
|
2018-11-08 01:04:06 +01:00
|
|
|
#include <mesosphere/threading/KScopedCriticalSection.hpp>
|
2018-11-05 03:51:50 -08:00
|
|
|
|
|
|
|
namespace mesosphere
|
|
|
|
{
|
2018-11-05 13:57:50 +01:00
|
|
|
|
|
|
|
bool KReadableEvent::IsSignaled() const
|
|
|
|
{
|
|
|
|
return this->isSignaled;
|
2018-11-05 03:51:50 -08:00
|
|
|
}
|
|
|
|
|
2018-11-05 13:57:50 +01:00
|
|
|
KReadableEvent::~KReadableEvent()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Result KReadableEvent::Signal()
|
|
|
|
{
|
|
|
|
KScopedCriticalSection criticalSection{};
|
2018-11-08 01:04:06 +01:00
|
|
|
|
2018-11-05 13:57:50 +01:00
|
|
|
if (!this->isSignaled) {
|
|
|
|
this->isSignaled = true;
|
|
|
|
NotifyWaiters();
|
2018-11-05 03:51:50 -08:00
|
|
|
}
|
2018-11-08 01:04:06 +01:00
|
|
|
|
2018-11-05 11:40:24 -08:00
|
|
|
return ResultSuccess();
|
2018-11-05 03:51:50 -08:00
|
|
|
}
|
|
|
|
|
2018-11-05 13:57:50 +01:00
|
|
|
Result KReadableEvent::Clear()
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
|
2018-11-05 11:40:24 -08:00
|
|
|
return ResultSuccess();
|
2018-11-05 03:51:50 -08:00
|
|
|
}
|
|
|
|
|
2018-11-05 13:57:50 +01:00
|
|
|
Result KReadableEvent::Reset()
|
|
|
|
{
|
|
|
|
KScopedCriticalSection criticalSection{};
|
|
|
|
|
|
|
|
if (this->isSignaled) {
|
|
|
|
this->isSignaled = false;
|
2018-11-05 11:40:24 -08:00
|
|
|
return ResultSuccess();
|
2018-11-05 03:51:50 -08:00
|
|
|
}
|
2018-11-05 11:40:24 -08:00
|
|
|
return ResultKernelInvalidState();
|
2018-11-05 03:51:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|