Thread scheduler rewrite (#393)

* Started to rewrite the thread scheduler

* Add a single core-like scheduling mode, enabled by default

* Clear exclusive monitor on context switch

* Add SetThreadActivity, misc fixes

* Implement WaitForAddress and SignalToAddress svcs, misc fixes

* Misc fixes (on SetActivity and Arbiter), other tweaks

* Rebased

* Add missing null check

* Rename multicore key on config, fix UpdatePriorityInheritance

* Make scheduling data MLQs private

* nit: Ordering
This commit is contained in:
gdkchan 2018-09-18 20:36:43 -03:00 committed by GitHub
parent 33e2810ef3
commit b8133c1997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 3262 additions and 1540 deletions

View file

@ -1,11 +1,10 @@
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.Services.Am;
using System;
using System.Collections.Concurrent;
namespace Ryujinx.HLE.HOS.SystemState
{
class AppletStateMgr : IDisposable
class AppletStateMgr
{
private ConcurrentQueue<MessageInfo> Messages;
@ -13,11 +12,11 @@ namespace Ryujinx.HLE.HOS.SystemState
public KEvent MessageEvent { get; private set; }
public AppletStateMgr()
public AppletStateMgr(Horizon System)
{
Messages = new ConcurrentQueue<MessageInfo>();
MessageEvent = new KEvent();
MessageEvent = new KEvent(System);
}
public void SetFocus(bool IsFocused)
@ -33,30 +32,17 @@ namespace Ryujinx.HLE.HOS.SystemState
{
Messages.Enqueue(Message);
MessageEvent.WaitEvent.Set();
MessageEvent.Signal();
}
public bool TryDequeueMessage(out MessageInfo Message)
{
if (Messages.Count < 2)
{
MessageEvent.WaitEvent.Reset();
MessageEvent.Reset();
}
return Messages.TryDequeue(out Message);
}
public void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool Disposing)
{
if (Disposing)
{
MessageEvent.Dispose();
}
}
}
}