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