mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Unconditionally await in awaitUntil (#1499)
Negative numbers are properly handled, which will reduce chances of deadlocks.
This commit is contained in:
committed by
Peter Johnson
parent
6593f4346e
commit
c449ef1064
@@ -276,9 +276,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
|
||||
private static boolean awaitUntil(Condition cond, long time) {
|
||||
long delta = time - RobotController.getFPGATime();
|
||||
try {
|
||||
if (delta > 0) {
|
||||
return cond.await(delta, TimeUnit.MICROSECONDS);
|
||||
}
|
||||
return cond.await(delta, TimeUnit.MICROSECONDS);
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
ex.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user