Code example for Semaphore

Methods: drainPermits

0
	} 
	 
	private class Manager 
	{ 
		private final Semaphore _lock              = new Semaphore(1);
		private final Semaphore _waitSignal        = new Semaphore(PROCESSOR_COUNT - 1, true);
		private       int       _waitCount         = 0;
		private       int       _lastLockedIndexes = -1;
		 
		private Manager() 
		{ 
			// Reserve all for manager so we can notify 
			// other Threads 
			_waitSignal.drainPermits();
		} 
		 
		private int aquirePairInLevel() 
		throws InterruptedException 
		{ 
			_lock.acquire();