Class DeadlockSun

java.lang.Object
  extended by 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.
 
Constructor Summary
DeadlockSun()
           
 
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
 

Field Detail

iAmDone

public static Semaphore iAmDone
Semaphore to signal that the bowing is over.

Constructor Detail

DeadlockSun

public DeadlockSun()
Method Detail

main

public static void main(String[] args)
Main program.