try {
final long start = System.nanoTime();
long left = unit.toNanos(timeout);
final long deadline = start + left;
for (int i = 0; sync != null; i++) {
s.awaitNanos(i, left);
if (sync == null)
break;
left = deadline - System.nanoTime();
if (left <= 0)
throw new TimeoutException();