Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
To guarantee safety, programs must test the {{while}} loop condition after returning from the {{wait()}} method. Although {{wait()}} is intended to block indefinitely until a notification is received, it must still be encased within a loop to prevent the following vulnerabilities \[[Bloch 2001|AA. Bibliography#Bloch 01]\]:

  • thread in the middle—A middle — A third thread can acquire the lock on the shared object during the interval between a notification being sent and the receiving thread resuming execution. This third thread can change the state of the object, leaving it inconsistent. This is a time-of-check-to-time-of-use (TOCTOU) condition.
  • malicious notification—A notification — A random or malicious notification can be received when the condition predicate is false. Such a notification would cancel the wait().
  • misdelivered notification—The notification — The order in which threads execute after receipt of a notifyAll() signal is unspecified. Consequently, an unrelated thread could start executing and discover that its condition predicate is satisfied. Consequently, it could resume execution, although it was required to remain dormant.
  • Wiki Markup
    spurious wake-ups—Certain-ups --- Certain JVM implementations are vulnerable to spurious wake-ups that result in waiting threads waking up even without a notification \[[API 2006|AA. Bibliography#API 06]\].

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="74842a15298e0603-897fc968-41824f4c-b8e788ae-fa2cd29ffe4b7fa85ec28684"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[Class Object

http://java.sun.com/javase/6/docs/api/java/lang/Object.html]

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ba673899c7f58cd4-2c1673a7-4aec497a-878d9f1e-2b81d13046378cd1ba4ef4cd"><ac:plain-text-body><![CDATA[

[[Bloch 2001

AA. Bibliography#Bloch 01]]

Item 50: Never invoke wait outside a loop

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="86060861d1ca42f5-df8ddd62-4aff4b67-9f969eef-79f7972b36da5584ce42a308"><ac:plain-text-body><![CDATA[

[[Lea 2000

AA. Bibliography#Lea 00]]

3.2.2 Monitor Mechanics, 1.3.2 Liveness

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d46ebb129b0790e5-2387cff9-44024af8-abae90e9-7b4b82fd4b5ea6acfaf03cef"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#Goetz 06]]

Section 14.2, Using Condition Queues

]]></ac:plain-text-body></ac:structured-macro>

...