mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Fixed FRCSim artf2619, and misc reformatting.
Change-Id: I7133f46f88f7e2cb2451c2a6714daa8f3f368b40
This commit is contained in:
@@ -79,6 +79,27 @@ public class Publisher<T extends Message> implements PublisherRecord {
|
||||
}
|
||||
}
|
||||
listeners.add(conn);
|
||||
this.notifyAll();
|
||||
}
|
||||
|
||||
public synchronized void waitForConnection() throws InterruptedException {
|
||||
while (this.listeners.isEmpty()) {
|
||||
this.wait();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean waitForConnection(long timeout_millis) throws InterruptedException {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
while (this.listeners.isEmpty()) {
|
||||
long remain = timeout_millis - (System.currentTimeMillis() - start);
|
||||
if (remain <= 0) {
|
||||
break;
|
||||
}
|
||||
this.wait(remain);
|
||||
}
|
||||
|
||||
return !this.listeners.isEmpty();
|
||||
}
|
||||
|
||||
public void setLatchMode(boolean b) {
|
||||
|
||||
Reference in New Issue
Block a user