Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6347010

(spec thread) Implementation detail poses hazard for wait(), notify{All}?() usage with join()

XMLWordPrintable

    • b18
    • generic
    • generic
    • Not verified

        Users need to understand that using wait, notify, and notifyAll on a Thread instance is a bad idea because Sun's implementation of Thread.join uses a loop of Object.wait on the Thread instance that is conditioned on !isAlive() and the JVM does a notifyAll on this object when the thread terminates. This means, for example, that thread termination can be confused with a notify or notifyAll if careful control of visibility is not maintained or inadequate condition expressions are used, causing an inappropriate escape from a wait loop. It also means users might depend on a "free" notifyAll stemming from thread termination when other compliant implementations will *NOT* provide this.

              chegar Chris Hegarty
              psoper Pete Soper (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: