Take out async keyword from hotplug routine. Delegate to different thread.

Further testing should be done to make sure there are no
regressions.
This commit is contained in:
Travis Nickles 2017-08-25 03:59:32 -05:00
parent 644c674a27
commit 33966389a4

View File

@ -1002,7 +1002,8 @@ namespace DS4Windows
if (!inHotPlug) if (!inHotPlug)
{ {
InnerHotplug2(); inHotPlug = true;
System.Threading.Tasks.Task.Run(() => { InnerHotplug2(); });
} }
} }
} }
@ -1017,7 +1018,7 @@ namespace DS4Windows
catch { } catch { }
} }
protected async void InnerHotplug2() protected void InnerHotplug2()
{ {
inHotPlug = true; inHotPlug = true;
System.Threading.SynchronizationContext uiContext = System.Threading.SynchronizationContext uiContext =
@ -1030,7 +1031,8 @@ namespace DS4Windows
while (loopHotplug == true) while (loopHotplug == true)
{ {
await System.Threading.Tasks.Task.Run(() => { Program.rootHub.HotPlug(uiContext); }); Program.rootHub.HotPlug(uiContext);
//System.Threading.Tasks.Task.Run(() => { Program.rootHub.HotPlug(uiContext); });
lock (hotplugCounterLock) lock (hotplugCounterLock)
{ {
hotplugCounter--; hotplugCounter--;