Add lock usage for USB again

The version without it seems a bit wonky
This commit is contained in:
Travis Nickles 2017-12-11 00:33:38 -06:00
parent ed2910208b
commit 05def00614

View File

@ -1029,9 +1029,11 @@ namespace DS4Windows
bool quitOutputThread = false; bool quitOutputThread = false;
bool usingBT = conType == ConnectionType.BT; bool usingBT = conType == ConnectionType.BT;
lock (outReportBuffer)
{
if (usingBT) if (usingBT)
{ {
Monitor.Enter(outReportBuffer);
outReportBuffer[0] = 0x11; outReportBuffer[0] = 0x11;
outReportBuffer[1] = (byte)(0x80 | btPollRate); // input report rate outReportBuffer[1] = (byte)(0x80 | btPollRate); // input report rate
// enable rumble (0x01), lightbar (0x02), flash (0x04) // enable rumble (0x01), lightbar (0x02), flash (0x04)
@ -1106,8 +1108,8 @@ namespace DS4Windows
Monitor.Pulse(outReportBuffer); Monitor.Pulse(outReportBuffer);
} }
} }
}
if (usingBT) { Monitor.Exit(outReportBuffer); }
if (quitOutputThread) if (quitOutputThread)
{ {
StopOutputUpdate(); StopOutputUpdate();