Пример #1
0
 /**
  * Releases all waiting threads and causes the {@link #limit} to be ignored until {@link #reset()}
  * is called.
  */
 public boolean releaseAll() {
   released = true;
   return sync.releaseShared(0);
 }
Пример #2
0
 /**
  * Releases a shared latch, making it available for another thread to use.
  *
  * @return the previous counter value
  */
 public long countDown() {
   sync.releaseShared(0);
   return count.get();
 }
Пример #3
0
 public void decrement() {
   sync.releaseShared(1);
 }
Пример #4
0
 /**
  * Decrements the count of the latch, releasing all waiting threads if the count reaches zero.
  *
  * <p>If the current count is greater than zero then it is decremented. If the new count is zero
  * then all waiting threads are re-enabled for thread scheduling purposes.
  *
  * <p>If the current count equals zero then nothing happens.
  */
 public void countDown() {
   sync.releaseShared(1);
 }
 public void signal() {
   sync.releaseShared(0);
 }