Fix some thread sync issues (#172)
* Fix some thread sync issues * Remove some debug stuff * Ensure that writes to the mutex address clears the exclusive monitor
This commit is contained in:
parent
a4020bb398
commit
3e6afeb513
8 changed files with 239 additions and 189 deletions
|
@ -58,25 +58,31 @@ namespace Ryujinx.HLE.OsHle.Handles
|
|||
|
||||
public void UpdatePriority()
|
||||
{
|
||||
int OldPriority = ActualPriority;
|
||||
|
||||
int CurrPriority = WantedPriority;
|
||||
bool PriorityChanged;
|
||||
|
||||
lock (Process.ThreadSyncLock)
|
||||
{
|
||||
int OldPriority = ActualPriority;
|
||||
|
||||
int CurrPriority = WantedPriority;
|
||||
|
||||
foreach (KThread Thread in MutexWaiters)
|
||||
{
|
||||
if (CurrPriority > Thread.WantedPriority)
|
||||
int WantedPriority = Thread.WantedPriority;
|
||||
|
||||
if (CurrPriority > WantedPriority)
|
||||
{
|
||||
CurrPriority = Thread.WantedPriority;
|
||||
CurrPriority = WantedPriority;
|
||||
}
|
||||
}
|
||||
|
||||
PriorityChanged = CurrPriority != OldPriority;
|
||||
|
||||
ActualPriority = CurrPriority;
|
||||
}
|
||||
|
||||
if (CurrPriority != OldPriority)
|
||||
if (PriorityChanged)
|
||||
{
|
||||
ActualPriority = CurrPriority;
|
||||
|
||||
Process.Scheduler.Resort(this);
|
||||
|
||||
MutexOwner?.UpdatePriority();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue