2018-09-23 11:11:46 -07:00
|
|
|
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()
|
|
|
|
{
|
2018-11-28 14:18:09 -08:00
|
|
|
System.CriticalSection.Enter();
|
2018-09-23 11:11:46 -07:00
|
|
|
|
|
|
|
if (!Signaled)
|
|
|
|
{
|
|
|
|
Signaled = true;
|
|
|
|
|
|
|
|
base.Signal();
|
|
|
|
}
|
|
|
|
|
2018-11-28 14:18:09 -08:00
|
|
|
System.CriticalSection.Leave();
|
2018-09-23 11:11:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public KernelResult Clear()
|
|
|
|
{
|
|
|
|
Signaled = false;
|
|
|
|
|
|
|
|
return KernelResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
public KernelResult ClearIfSignaled()
|
|
|
|
{
|
|
|
|
KernelResult Result;
|
|
|
|
|
2018-11-28 14:18:09 -08:00
|
|
|
System.CriticalSection.Enter();
|
2018-09-23 11:11:46 -07:00
|
|
|
|
|
|
|
if (Signaled)
|
|
|
|
{
|
|
|
|
Signaled = false;
|
|
|
|
|
|
|
|
Result = KernelResult.Success;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Result = KernelResult.InvalidState;
|
|
|
|
}
|
|
|
|
|
2018-11-28 14:18:09 -08:00
|
|
|
System.CriticalSection.Leave();
|
2018-09-23 11:11:46 -07:00
|
|
|
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool IsSignaled()
|
|
|
|
{
|
|
|
|
return Signaled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|