2018-12-18 08:33:36 +03:00
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
2018-09-19 02:36:43 +03:00
|
|
|
using System.Collections.Generic;
|
2018-03-19 21:58:46 +03:00
|
|
|
|
2018-12-18 08:33:36 +03:00
|
|
|
namespace Ryujinx.HLE.HOS.Kernel.Common
|
2018-03-19 21:58:46 +03:00
|
|
|
{
|
2018-11-29 01:18:09 +03:00
|
|
|
class KSynchronizationObject : KAutoObject
|
2018-03-19 21:58:46 +03:00
|
|
|
{
|
2019-01-19 01:26:39 +03:00
|
|
|
public LinkedList<KThread> WaitingThreads { get; }
|
2018-03-19 21:58:46 +03:00
|
|
|
|
2020-05-04 06:41:29 +03:00
|
|
|
public KSynchronizationObject(KernelContext context) : base(context)
|
2018-09-19 02:36:43 +03:00
|
|
|
{
|
|
|
|
WaitingThreads = new LinkedList<KThread>();
|
|
|
|
}
|
|
|
|
|
2018-12-06 14:16:24 +03:00
|
|
|
public LinkedListNode<KThread> AddWaitingThread(KThread thread)
|
2018-09-19 02:36:43 +03:00
|
|
|
{
|
2018-12-06 14:16:24 +03:00
|
|
|
return WaitingThreads.AddLast(thread);
|
2018-09-19 02:36:43 +03:00
|
|
|
}
|
|
|
|
|
2018-12-06 14:16:24 +03:00
|
|
|
public void RemoveWaitingThread(LinkedListNode<KThread> node)
|
2018-03-19 21:58:46 +03:00
|
|
|
{
|
2018-12-06 14:16:24 +03:00
|
|
|
WaitingThreads.Remove(node);
|
2018-03-19 21:58:46 +03:00
|
|
|
}
|
|
|
|
|
2018-09-19 02:36:43 +03:00
|
|
|
public virtual void Signal()
|
2018-03-19 21:58:46 +03:00
|
|
|
{
|
2020-05-04 06:41:29 +03:00
|
|
|
KernelContext.Synchronization.SignalObject(this);
|
2018-03-19 21:58:46 +03:00
|
|
|
}
|
|
|
|
|
2018-09-19 02:36:43 +03:00
|
|
|
public virtual bool IsSignaled()
|
2018-03-19 21:58:46 +03:00
|
|
|
{
|
2018-09-19 02:36:43 +03:00
|
|
|
return false;
|
2018-03-19 21:58:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|