### Question:
BinaryLatch { public void release() { Node waiters = (Node) UnsafeUtil.getAndSetObject( this, stackOffset, released ); if ( waiters == null ) { return; } unparkSuccessor( waiters ); }  void release(); void await();  }### Answer:
@Test void releaseMustUnblockAwaiters() { assertTimeout( ofSeconds( 10 ), () -> { final BinaryLatch latch = new BinaryLatch(); Runnable awaiter = latch::await; int awaiters = 10; Thread[] threads = new Thread[awaiters]; for ( int i = 0; i < awaiters; i++ ) { threads[i] = new Thread( awaiter ); threads[i].start(); } long deadline = TimeUnit.SECONDS.toNanos( 10 ) + System.nanoTime(); while ( deadline - System.nanoTime() > 0 ) { if ( threads[0].getState() == Thread.State.WAITING ) { break; } Thread.sleep( 10 ); } threads[0].join( 10 ); try { assertEquals( Thread.State.WAITING, threads[0].getState() ); } finally { latch.release(); for ( Thread thread : threads ) { thread.join(); } } } ); }