Changed when delay is performed for exclusive mode routine

Keep an eye on this
This commit is contained in:
Travis Nickles 2018-02-28 15:09:29 -06:00
parent 01e5246c61
commit 531b79dcc3

View File

@ -309,16 +309,6 @@ namespace DS4Windows
} }
*/ */
//System.Threading.Thread.Sleep(50);
sw.Restart();
while (sw.ElapsedMilliseconds < 50)
{
// Use SpinWait to keep control of current thread. Using Sleep could potentially
// cause other events to get run out of order
System.Threading.Thread.SpinWait(100);
}
sw.Stop();
propChangeParams.stateChange = NativeMethods.DICS_ENABLE; propChangeParams.stateChange = NativeMethods.DICS_ENABLE;
success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams)); success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams));
if (!success) if (!success)
@ -331,6 +321,16 @@ namespace DS4Windows
throw new Exception("Error enabling device, error code = " + Marshal.GetLastWin32Error()); throw new Exception("Error enabling device, error code = " + Marshal.GetLastWin32Error());
} }
//System.Threading.Thread.Sleep(50);
sw.Restart();
while (sw.ElapsedMilliseconds < 50)
{
// Use SpinWait to keep control of current thread. Using Sleep could potentially
// cause other events to get run out of order
System.Threading.Thread.SpinWait(100);
}
sw.Stop();
NativeMethods.SetupDiDestroyDeviceInfoList(deviceInfoSet); NativeMethods.SetupDiDestroyDeviceInfoList(deviceInfoSet);
} }
} }