Thread priority changes

This commit is contained in:
Travis Nickles 2017-08-27 03:45:35 -05:00
parent e0daa9683f
commit c8809f37cb
2 changed files with 5 additions and 13 deletions

View File

@ -41,15 +41,9 @@ namespace DS4Windows
{ {
//sp.Stream = Properties.Resources.EE; //sp.Stream = Properties.Resources.EE;
// Cause thread affinity to not be tied to main GUI thread // Cause thread affinity to not be tied to main GUI thread
Thread x360Thread = new Thread(() => { x360Bus = new X360Device(); }); Task.Run(() => {
x360Thread.IsBackground = true; Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
x360Thread.Priority = ThreadPriority.Normal; x360Bus = new X360Device(); }).Wait();
x360Thread.Name = "SCP Virtual Bus Thread";
x360Thread.Start();
while (!x360Thread.ThreadState.HasFlag(ThreadState.Stopped))
{
Thread.SpinWait(500);
}
AddtoDS4List(); AddtoDS4List();
@ -209,7 +203,6 @@ namespace DS4Windows
} }
runHotPlug = true; runHotPlug = true;
return true; return true;
} }

View File

@ -148,9 +148,7 @@ namespace DS4Windows
new SaveWhere(false).ShowDialog(); new SaveWhere(false).ShowDialog();
} }
Thread AppCollectionThread = new Thread(() => CheckDrivers()); TaskRunner.Run(() => CheckDrivers());
AppCollectionThread.IsBackground = true;
AppCollectionThread.Start();
if (string.IsNullOrEmpty(appdatapath)) if (string.IsNullOrEmpty(appdatapath))
{ {
@ -949,6 +947,7 @@ namespace DS4Windows
var uiContext = SynchronizationContext.Current; var uiContext = SynchronizationContext.Current;
TaskRunner.Run(() => TaskRunner.Run(() =>
{ {
//Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
Program.rootHub.Start(uiContext, log); Program.rootHub.Start(uiContext, log);
this.Invoke((System.Action)(() => { serviceStartupFinish(); })); this.Invoke((System.Action)(() => { serviceStartupFinish(); }));
}); });