Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit ab9fd05

Browse files
committed
Use manualresetevent timeout as a precaution
1 parent 483c366 commit ab9fd05

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

DS4Windows/DS4Library/DS4Device.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,20 +1989,23 @@ public void queueEvent(Action act)
19891989
public void HaltReportingRunAction(Action act)
19901990
{
19911991
// Wait for controller to be in a wait period
1992-
readWaitEv.Wait();
1993-
readWaitEv.Reset();
1992+
bool result = readWaitEv.Wait(millisecondsTimeout: 500);
1993+
if (result)
1994+
{
1995+
readWaitEv.Reset();
19941996

1995-
// Tell device to no longer fire reports
1996-
fireReport = false;
1997+
// Tell device to no longer fire reports
1998+
fireReport = false;
19971999

1998-
// Flag is set. Allow input thread to resume
1999-
readWaitEv.Set();
2000+
// Flag is set. Allow input thread to resume
2001+
readWaitEv.Set();
20002002

2001-
// Invoke main desired action
2002-
act?.Invoke();
2003+
// Invoke main desired action
2004+
act?.Invoke();
20032005

2004-
// Start firing reports again
2005-
fireReport = true;
2006+
// Start firing reports again
2007+
fireReport = true;
2008+
}
20062009
}
20072010

20082011
public void updateSerial()

0 commit comments

Comments
 (0)