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