mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-10 19:36:40 +00:00
0039bb6394
* Refactor SVC handler * Get rid of KernelErr * Split kernel code files into multiple folders
64 lines
No EOL
1.3 KiB
C#
64 lines
No EOL
1.3 KiB
C#
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
|
|
namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|
{
|
|
class KReadableEvent : KSynchronizationObject
|
|
{
|
|
private KEvent _parent;
|
|
|
|
private bool _signaled;
|
|
|
|
public KReadableEvent(Horizon system, KEvent parent) : base(system)
|
|
{
|
|
_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;
|
|
}
|
|
}
|
|
} |