1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-11 07:26:40 +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
{
private KEvent Parent;
private bool Signaled;
public KReadableEvent(Horizon System, KEvent Parent) : base(System)
{
this.Parent = Parent;
}
public override void Signal()
{
System.CriticalSection.Enter();
if (!Signaled)
{
Signaled = true;
base.Signal();
}
System.CriticalSection.Leave();
}
public KernelResult Clear()
{
Signaled = false;
return KernelResult.Success;
}
public KernelResult ClearIfSignaled()
{
KernelResult Result;
System.CriticalSection.Enter();
if (Signaled)
{
Signaled = false;
Result = KernelResult.Success;
}
else
{
Result = KernelResult.InvalidState;
}
System.CriticalSection.Leave();
return Result;
}
public override bool IsSignaled()
{
return Signaled;
}
}
}