Skip to content

Commit

Permalink
Delay is on a best effort basis (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-lawrey authored May 13, 2024
1 parent 99fd931 commit f1302ee
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/test/java/net/openhft/chronicle/threads/LongPauserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ public void unpauseStopsPausing() throws InterruptedException {
@Test
public void testLongAsyncPauser() {
final LongPauser pauser = new LongPauser(0, 0, 1, 1, TimeUnit.MILLISECONDS);
for (int i = 0; i < 5; i++) {
pauser.asyncPause();
testUntilUnpaused(pauser, 1, TimeUnit.MILLISECONDS);
pauser.reset();
testUntilUnpaused(pauser, 0, TimeUnit.MILLISECONDS);
boolean failedOnce = false;
for (int i = 0; i < 100; i++) {
try {
pauser.asyncPause();
testUntilUnpaused(pauser, 1, TimeUnit.MILLISECONDS);
pauser.reset();
testUntilUnpaused(pauser, 0, TimeUnit.MILLISECONDS);
} catch (AssertionError e) {
if (failedOnce)
throw e;
failedOnce = true;
}
}
}

Expand Down

0 comments on commit f1302ee

Please sign in to comment.