1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-02 22:12:02 +00:00
Ryujinx/Ryujinx.HLE/HOS/Kernel/KReadableEvent.cs

62 lines
1.2 KiB
C#
Raw Normal View History

namespace Ryujinx.HLE.HOS.Kernel
{
class KReadableEvent : KSynchronizationObject
{
2018-12-01 20:01:59 +00:00
private KEvent _parent;
2018-12-01 20:01:59 +00:00
private bool _signaled;
2018-12-01 20:01:59 +00:00
public KReadableEvent(Horizon system, KEvent parent) : base(system)
{
2018-12-01 20:24:37 +00:00
_parent = parent;
}
public override void Signal()
{
System.CriticalSection.Enter();
2018-12-01 20:01:59 +00:00
if (!_signaled)
{
2018-12-01 20:01:59 +00:00
_signaled = true;
base.Signal();
}
System.CriticalSection.Leave();
}
public KernelResult Clear()
{
2018-12-01 20:01:59 +00:00
_signaled = false;
return KernelResult.Success;
}
public KernelResult ClearIfSignaled()
{
2018-12-01 20:01:59 +00:00
KernelResult result;
System.CriticalSection.Enter();
2018-12-01 20:01:59 +00:00
if (_signaled)
{
2018-12-01 20:01:59 +00:00
_signaled = false;
2018-12-01 20:01:59 +00:00
result = KernelResult.Success;
}
else
{
2018-12-01 20:01:59 +00:00
result = KernelResult.InvalidState;
}
System.CriticalSection.Leave();
2018-12-01 20:01:59 +00:00
return result;
}
public override bool IsSignaled()
{
2018-12-01 20:01:59 +00:00
return _signaled;
}
}
}