diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-05-13 00:22:42 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-05-13 00:22:42 -0300 |
| commit | 4546d1b9be1052bbf82858d97795b33355bf64da (patch) | |
| tree | a88286d145d8da522a81b3a265c538e7795b7f8d /Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs | |
| parent | 3603497a137d14f2d65c5450133f2486a9f9620c (diff) | |
Initial work to support changing thread core on the scheduler, also some cond var priority fixes
Diffstat (limited to 'Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs')
| -rw-r--r-- | Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs b/Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs index 57608cda..0ca2a5f9 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcThreadSync.cs @@ -260,17 +260,23 @@ namespace Ryujinx.Core.OsHle.Kernel WaitThread.MutexAddress = MutexAddress; WaitThread.CondVarAddress = CondVarAddress; - lock (CondVarLock) + lock (Process.ThreadArbiterListLock) { - KThread CurrThread = Process.ThreadArbiterList; + KThread CurrThread = Process.ThreadArbiterListHead; - if (CurrThread != null) + if (CurrThread == null || CurrThread.ActualPriority > WaitThread.ActualPriority) + { + WaitThread.NextCondVarThread = Process.ThreadArbiterListHead; + + Process.ThreadArbiterListHead = WaitThread; + } + else { bool DoInsert = CurrThread != WaitThread; while (CurrThread.NextCondVarThread != null) { - if (CurrThread.NextCondVarThread.ActualPriority < WaitThread.ActualPriority) + if (CurrThread.NextCondVarThread.ActualPriority > WaitThread.ActualPriority) { break; } @@ -293,10 +299,6 @@ namespace Ryujinx.Core.OsHle.Kernel CurrThread.NextCondVarThread = WaitThread; } } - else - { - Process.ThreadArbiterList = WaitThread; - } } Ns.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state..."); @@ -315,10 +317,10 @@ namespace Ryujinx.Core.OsHle.Kernel private void CondVarSignal(long CondVarAddress, int Count) { - lock (CondVarLock) + lock (Process.ThreadArbiterListLock) { KThread PrevThread = null; - KThread CurrThread = Process.ThreadArbiterList; + KThread CurrThread = Process.ThreadArbiterListHead; while (CurrThread != null && (Count == -1 || Count > 0)) { @@ -330,7 +332,7 @@ namespace Ryujinx.Core.OsHle.Kernel } else { - Process.ThreadArbiterList = CurrThread.NextCondVarThread; + Process.ThreadArbiterListHead = CurrThread.NextCondVarThread; } CurrThread.NextCondVarThread = null; @@ -401,7 +403,7 @@ namespace Ryujinx.Core.OsHle.Kernel return; } - if (CurrThread.NextMutexThread.ActualPriority < WaitThread.ActualPriority) + if (CurrThread.NextMutexThread.ActualPriority > WaitThread.ActualPriority) { break; } |
