Testing new output report copying thread for USB and SONYWA

This commit is contained in:
Travis Nickles 2018-10-26 20:58:43 -05:00
parent e3ed777682
commit 49d24fce7d

View File

@ -539,6 +539,14 @@ namespace DS4Windows
timeoutCheckThread.IsBackground = true; timeoutCheckThread.IsBackground = true;
timeoutCheckThread.Start(); timeoutCheckThread.Start();
} }
else
{
ds4Output = new Thread(OutReportCopy);
ds4Output.Priority = ThreadPriority.AboveNormal;
ds4Output.Name = "DS4 Arr Copy thread: " + Mac;
ds4Output.IsBackground = true;
ds4Output.Start();
}
ds4Input = new Thread(performDs4Input); ds4Input = new Thread(performDs4Input);
ds4Input.Priority = ThreadPriority.AboveNormal; ds4Input.Priority = ThreadPriority.AboveNormal;
@ -1203,6 +1211,10 @@ namespace DS4Windows
{ {
Monitor.Exit(outputReport); Monitor.Exit(outputReport);
} }
else
{
Monitor.Pulse(outReportBuffer);
}
} }
} }
else else
@ -1229,6 +1241,22 @@ namespace DS4Windows
} }
} }
public void OutReportCopy()
{
try
{
while (!exitOutputThread)
{
lock (outReportBuffer)
{
outReportBuffer.CopyTo(outputReport, 0);
Monitor.Wait(outReportBuffer);
}
}
}
catch (ThreadInterruptedException) { }
}
public bool DisconnectBT(bool callRemoval = false) public bool DisconnectBT(bool callRemoval = false)
{ {
if (Mac != null) if (Mac != null)