aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/KSynchronization.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2018-12-06 05:16:24 -0600
committergdkchan <gab.dark.100@gmail.com>2018-12-06 09:16:24 -0200
commitfb1d9493a3d43f2b86c551682586905a1f0e9ea7 (patch)
treed842685ff5bdd45d11d94bd1a45a002b9d532fe7 /Ryujinx.HLE/HOS/Kernel/KSynchronization.cs
parent3615a70cae3f89197fe185dfc5d0a47fa42151d9 (diff)
Adjust naming conventions and general refactoring in HLE Project (#527)
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Apply previous refactorings to the merged code
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/KSynchronization.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/KSynchronization.cs108
1 files changed, 54 insertions, 54 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/KSynchronization.cs b/Ryujinx.HLE/HOS/Kernel/KSynchronization.cs
index 19e700f4..51b74a03 100644
--- a/Ryujinx.HLE/HOS/Kernel/KSynchronization.cs
+++ b/Ryujinx.HLE/HOS/Kernel/KSynchronization.cs
@@ -6,130 +6,130 @@ namespace Ryujinx.HLE.HOS.Kernel
{
class KSynchronization
{
- private Horizon System;
+ private Horizon _system;
- public KSynchronization(Horizon System)
+ public KSynchronization(Horizon system)
{
- this.System = System;
+ _system = system;
}
- public long WaitFor(KSynchronizationObject[] SyncObjs, long Timeout, ref int HndIndex)
+ public long WaitFor(KSynchronizationObject[] syncObjs, long timeout, ref int hndIndex)
{
- long Result = MakeError(ErrorModule.Kernel, KernelErr.Timeout);
+ long result = MakeError(ErrorModule.Kernel, KernelErr.Timeout);
- System.CriticalSection.Enter();
+ _system.CriticalSection.Enter();
//Check if objects are already signaled before waiting.
- for (int Index = 0; Index < SyncObjs.Length; Index++)
+ for (int index = 0; index < syncObjs.Length; index++)
{
- if (!SyncObjs[Index].IsSignaled())
+ if (!syncObjs[index].IsSignaled())
{
continue;
}
- HndIndex = Index;
+ hndIndex = index;
- System.CriticalSection.Leave();
+ _system.CriticalSection.Leave();
return 0;
}
- if (Timeout == 0)
+ if (timeout == 0)
{
- System.CriticalSection.Leave();
+ _system.CriticalSection.Leave();
- return Result;
+ return result;
}
- KThread CurrentThread = System.Scheduler.GetCurrentThread();
+ KThread currentThread = _system.Scheduler.GetCurrentThread();
- if (CurrentThread.ShallBeTerminated ||
- CurrentThread.SchedFlags == ThreadSchedState.TerminationPending)
+ if (currentThread.ShallBeTerminated ||
+ currentThread.SchedFlags == ThreadSchedState.TerminationPending)
{
- Result = MakeError(ErrorModule.Kernel, KernelErr.ThreadTerminating);
+ result = MakeError(ErrorModule.Kernel, KernelErr.ThreadTerminating);
}
- else if (CurrentThread.SyncCancelled)
+ else if (currentThread.SyncCancelled)
{
- CurrentThread.SyncCancelled = false;
+ currentThread.SyncCancelled = false;
- Result = MakeError(ErrorModule.Kernel, KernelErr.Cancelled);
+ result = MakeError(ErrorModule.Kernel, KernelErr.Cancelled);
}
else
{
- LinkedListNode<KThread>[] SyncNodes = new LinkedListNode<KThread>[SyncObjs.Length];
+ LinkedListNode<KThread>[] syncNodes = new LinkedListNode<KThread>[syncObjs.Length];
- for (int Index = 0; Index < SyncObjs.Length; Index++)
+ for (int index = 0; index < syncObjs.Length; index++)
{
- SyncNodes[Index] = SyncObjs[Index].AddWaitingThread(CurrentThread);
+ syncNodes[index] = syncObjs[index].AddWaitingThread(currentThread);
}
- CurrentThread.WaitingSync = true;
- CurrentThread.SignaledObj = null;
- CurrentThread.ObjSyncResult = (int)Result;
+ currentThread.WaitingSync = true;
+ currentThread.SignaledObj = null;
+ currentThread.ObjSyncResult = (int)result;
- CurrentThread.Reschedule(ThreadSchedState.Paused);
+ currentThread.Reschedule(ThreadSchedState.Paused);
- if (Timeout > 0)
+ if (timeout > 0)
{
- System.TimeManager.ScheduleFutureInvocation(CurrentThread, Timeout);
+ _system.TimeManager.ScheduleFutureInvocation(currentThread, timeout);
}
- System.CriticalSection.Leave();
+ _system.CriticalSection.Leave();
- CurrentThread.WaitingSync = false;
+ currentThread.WaitingSync = false;
- if (Timeout > 0)
+ if (timeout > 0)
{
- System.TimeManager.UnscheduleFutureInvocation(CurrentThread);
+ _system.TimeManager.UnscheduleFutureInvocation(currentThread);
}
- System.CriticalSection.Enter();
+ _system.CriticalSection.Enter();
- Result = (uint)CurrentThread.ObjSyncResult;
+ result = (uint)currentThread.ObjSyncResult;
- HndIndex = -1;
+ hndIndex = -1;
- for (int Index = 0; Index < SyncObjs.Length; Index++)
+ for (int index = 0; index < syncObjs.Length; index++)
{
- SyncObjs[Index].RemoveWaitingThread(SyncNodes[Index]);
+ syncObjs[index].RemoveWaitingThread(syncNodes[index]);
- if (SyncObjs[Index] == CurrentThread.SignaledObj)
+ if (syncObjs[index] == currentThread.SignaledObj)
{
- HndIndex = Index;
+ hndIndex = index;
}
}
}
- System.CriticalSection.Leave();
+ _system.CriticalSection.Leave();
- return Result;
+ return result;
}
- public void SignalObject(KSynchronizationObject SyncObj)
+ public void SignalObject(KSynchronizationObject syncObj)
{
- System.CriticalSection.Enter();
+ _system.CriticalSection.Enter();
- if (SyncObj.IsSignaled())
+ if (syncObj.IsSignaled())
{
- LinkedListNode<KThread> Node = SyncObj.WaitingThreads.First;
+ LinkedListNode<KThread> node = syncObj.WaitingThreads.First;
- while (Node != null)
+ while (node != null)
{
- KThread Thread = Node.Value;
+ KThread thread = node.Value;
- if ((Thread.SchedFlags & ThreadSchedState.LowMask) == ThreadSchedState.Paused)
+ if ((thread.SchedFlags & ThreadSchedState.LowMask) == ThreadSchedState.Paused)
{
- Thread.SignaledObj = SyncObj;
- Thread.ObjSyncResult = 0;
+ thread.SignaledObj = syncObj;
+ thread.ObjSyncResult = 0;
- Thread.Reschedule(ThreadSchedState.Running);
+ thread.Reschedule(ThreadSchedState.Running);
}
- Node = Node.Next;
+ node = node.Next;
}
}
- System.CriticalSection.Leave();
+ _system.CriticalSection.Leave();
}
}
} \ No newline at end of file