Class DeadlockSun
java.lang.Object
DeadlockSun
public class DeadlockSun
- extends Object
Alphonse bows to Gaston and Gaston bows to Alphonse.
As bowBack()
is a synchronized method, both wait for the other to bow back.
This is an adaptation of the example in the Java Tutorial.
- See Also:
- http://java.sun.com/docs/books/tutorial/essential/concurrency/deadlock.html
Field Summary |
static Semaphore |
iAmDone
Semaphore to signal that the bowing is over. |
Method Summary |
static void |
main(String[] args)
Main program. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iAmDone
public static Semaphore iAmDone
- Semaphore to signal that the bowing is over.
DeadlockSun
public DeadlockSun()
main
public static void main(String[] args)
- Main program.