Lock with counter
Hello all,
I wish to have a lock with the following features.
1. My main thread will create a lock with counter 5. Then my main thread will spawn n threads to perform some task. My main thread will wait for the lock forever, until the counter become 0.
2. The worker threads will decrease the lock's counter, at certain situation.
3. My main thread will continue execution, until the lock's counter become one.
Of course, I know I can do this by using wait, notify, AtomicInteger. However, I believe Java 6 should have a class for this kind of so called "lock with counter"?
If yes, may I know the name of the standard class?
Thank you very much!

