Rewrite scheduler context switch code (#1786)
* Rewrite scheduler context switch code * Fix race in UnmapIpcRestorePermission * Fix thread exit issue that could leave the scheduler in a invalid state * Change context switch method to not wait on guest thread, remove spin wait, use SignalAndWait to pass control * Remove multi-core setting (it is always on now) * Re-enable assert * Remove multicore from default config and schema * Fix race in KTimeManager
This commit is contained in:
parent
3484265d37
commit
48278905d1
37 changed files with 1080 additions and 1160 deletions
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Kernel.Common
|
||||
|
@ -47,17 +48,25 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
|||
|
||||
public void IncrementReferenceCount()
|
||||
{
|
||||
Interlocked.Increment(ref _referenceCount);
|
||||
int newRefCount = Interlocked.Increment(ref _referenceCount);
|
||||
|
||||
Debug.Assert(newRefCount >= 2);
|
||||
}
|
||||
|
||||
public void DecrementReferenceCount()
|
||||
{
|
||||
if (Interlocked.Decrement(ref _referenceCount) == 0)
|
||||
int newRefCount = Interlocked.Decrement(ref _referenceCount);
|
||||
|
||||
Debug.Assert(newRefCount >= 0);
|
||||
|
||||
if (newRefCount == 0)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Destroy() { }
|
||||
protected virtual void Destroy()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue