About
Articles Related
Java
The following actions create happens-before relationships:
- synchronized construct. When a thread releases an intrinsic lock, a happens-before relationship is established between that action and any subsequent acquisition of the same lock.
- volatile constructs
- Thread.start: Every statement that has a happens-before relationship with that statement also has a happens-before relationship with every statement executed by the new thread. The effects of the code that led up to the creation of the new thread are visible to the new thread.
- Thread.join. All the statements executed by the terminated thread have a happens-before relationship with all the statements following the successful join. The effects of the code in the thread are now visible to the thread that performed the join.
For a list of actions that create happens-before relationships, refer to the Summary page of the java.util.concurrent package..
Documentation / Reference
- Chapter 17 of the Java Language Specification defines the happens-before relation on memory operations such as reads and writes of shared variables.