diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 5789662..e8d83d2 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -41,15 +41,9 @@ namespace DS4Windows { //sp.Stream = Properties.Resources.EE; // Cause thread affinity to not be tied to main GUI thread - Thread x360Thread = new Thread(() => { x360Bus = new X360Device(); }); - x360Thread.IsBackground = true; - x360Thread.Priority = ThreadPriority.Normal; - x360Thread.Name = "SCP Virtual Bus Thread"; - x360Thread.Start(); - while (!x360Thread.ThreadState.HasFlag(ThreadState.Stopped)) - { - Thread.SpinWait(500); - } + Task.Run(() => { + Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; + x360Bus = new X360Device(); }).Wait(); AddtoDS4List(); @@ -209,7 +203,6 @@ namespace DS4Windows } runHotPlug = true; - return true; } diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 3044314..48e361b 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -148,9 +148,7 @@ namespace DS4Windows new SaveWhere(false).ShowDialog(); } - Thread AppCollectionThread = new Thread(() => CheckDrivers()); - AppCollectionThread.IsBackground = true; - AppCollectionThread.Start(); + TaskRunner.Run(() => CheckDrivers()); if (string.IsNullOrEmpty(appdatapath)) { @@ -949,6 +947,7 @@ namespace DS4Windows var uiContext = SynchronizationContext.Current; TaskRunner.Run(() => { + //Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; Program.rootHub.Start(uiContext, log); this.Invoke((System.Action)(() => { serviceStartupFinish(); })); });