Change some thread priorities

This commit is contained in:
Travis Nickles 2017-06-19 21:37:08 -07:00
parent 08be7f1060
commit d6d6f63073
2 changed files with 4 additions and 2 deletions

View File

@ -43,7 +43,7 @@ namespace DS4Windows
// Cause thread affinity to not be tied to main GUI thread
Thread x360Thread = new Thread(() => { x360Bus = new X360Device(); });
x360Thread.IsBackground = true;
x360Thread.Priority = ThreadPriority.AboveNormal;
x360Thread.Priority = ThreadPriority.Normal;
x360Thread.Name = "SCP Virtual Bus Thread";
x360Thread.Start();
while (!x360Thread.ThreadState.HasFlag(ThreadState.Stopped))

View File

@ -72,6 +72,7 @@ namespace DS4Windows
return;
}
}
System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.LowLatency;
try
@ -126,6 +127,7 @@ namespace DS4Windows
{
BackgroundWorker worker = sender as BackgroundWorker;
WaitHandle[] waitHandles = new WaitHandle[] { threadComEvent };
Thread.CurrentThread.Priority = ThreadPriority.Lowest;
while (!worker.CancellationPending)
{
@ -144,7 +146,6 @@ namespace DS4Windows
}
}
/// <summary>
/// When this method is called using a Invoke then this runs in the thread
/// that created the form, which is nice.
@ -169,6 +170,7 @@ namespace DS4Windows
SetForegroundWindow(wp.form.Handle);
}
}
SetForegroundWindow(frm.Handle);
}
}