This is a method in MFC,wait for more than one lock,anyone of it notify,the thread go far,do something.
- Posted by: cui ying
- Posted on: April 23 2006 22:25 EDT
- How can I make a thread wait for more than one lock? by Hugues Ferland on April 25 2006 08:51 EDT
- is this the right question? by Jason Frank on May 16 2006 18:22 EDT
Look at java.util.concurrent package. There is CountdownLatch and CyclicBarrier classes that may help.
Are you sure you want that? Or is the question you really are asking more to do with if you have a limited resource, and you want to have a fixed set of "locks" over the resource, and threads wait to acquire from a fixed set of leases? Once a lease is released the next waiting thread is notified and acquires the lease. If you're using Java 5, the JDK now provides very constructs you can use for fixed pool lease semantics. If you're not using Java 5 - I recommend Doug Lea's original: http://g.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html