Created
February 26, 2013 15:24
-
-
Save c2nes/5039265 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loop until tripped, broken, interrupted, or timed out | |
for (;;) { | |
try { | |
if (!timed) | |
trip.await(); | |
else if (nanos > 0L) | |
nanos = trip.awaitNanos(nanos); | |
} catch (InterruptedException ie) { | |
if (g == generation && ! g.broken) { | |
breakBarrier(); | |
throw ie; | |
} else { | |
// We're about to finish waiting even if we had not | |
// been interrupted, so this interrupt is deemed to | |
// "belong" to subsequent execution. | |
Thread.currentThread().interrupt(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment