Code example for Semaphore

Methods: availablePermits

0
    public boolean WaitOne(int timeOut, TimeUnit unit) throws InterruptedException {
        return event.tryAcquire(timeOut, unit);
    } 
 
    public boolean isSignalled() { 
        return event.availablePermits() > 0;
    } 
}