hb的含义,是以前的操做写入的东西,对以后的操做都是可见的java
具备传递性,若是A hb B,B hb C,那么A hb C并发
synchronized
block or method exit) of a monitor happens-before every subsequent lock (synchronized
block or method entry) of that same monitor. And because the happens-before relation is transitive, all actions of a thread prior to unlocking happen-before all actions subsequent to any thread locking that monitor.volatile
field happens-before every subsequent read of that same field. Writes and reads of volatile
fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking.start
on a thread happens-before any action in the started thread.join
on that thread.The methods of all classes in java.util.concurrent
and its subpackages extend these guarantees to higher-level synchronization. In particular:app
Runnable
to an Executor
happen-before its execution begins. Similarly for Callables
submitted to an ExecutorService
.Future
happen-before actions subsequent to the retrieval of the result via Future.get()
in another thread.Lock.unlock
, Semaphore.release
, and CountDownLatch.countDown
happen-before actions subsequent to a successful "acquiring" method such as Lock.lock
, Semaphore.acquire
, Condition.await
, and CountDownLatch.await
on the same synchronizer object in another thread.Lock.unlock
, Semaphore.release
, and CountDownLatch.countDown)老是hb 以后成功获取锁后发生的。
Exchanger
, actions prior to the exchange()
in each thread happen-before those subsequent to the corresponding exchange()
in another thread.CyclicBarrier.await
and Phaser.awaitAdvance
(as well as its variants) happen-before actions performed by the barrier action, and actions performed by the barrier action happen-before actions subsequent to a successful return from the corresponding await
in other threads.CyclicBarrier.await
and Phaser.awaitAdvance以前发生的,老是hb 被内存栅栏执行的动做,内存栅栏执行的动做,老是hb 其余线程调用await返回以后