956 * Version of {@link #putObjectVolatile(Object, long, Object)} |
956 * Version of {@link #putObjectVolatile(Object, long, Object)} |
957 * that does not guarantee immediate visibility of the store to |
957 * that does not guarantee immediate visibility of the store to |
958 * other threads. This method is generally only useful if the |
958 * other threads. This method is generally only useful if the |
959 * underlying field is a Java volatile (or if an array cell, one |
959 * underlying field is a Java volatile (or if an array cell, one |
960 * that is otherwise only accessed using volatile accesses). |
960 * that is otherwise only accessed using volatile accesses). |
|
961 * |
|
962 * Corresponds to C11 atomic_store_explicit(..., memory_order_release). |
961 */ |
963 */ |
962 public native void putOrderedObject(Object o, long offset, Object x); |
964 public native void putOrderedObject(Object o, long offset, Object x); |
963 |
965 |
964 /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */ |
966 /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */ |
965 public native void putOrderedInt(Object o, long offset, int x); |
967 public native void putOrderedInt(Object o, long offset, int x); |
1109 return v; |
1111 return v; |
1110 } |
1112 } |
1111 |
1113 |
1112 |
1114 |
1113 /** |
1115 /** |
1114 * Ensures lack of reordering of loads before the fence |
1116 * Ensures that loads before the fence will not be reordered with loads and |
1115 * with loads or stores after the fence. |
1117 * stores after the fence; a "LoadLoad plus LoadStore barrier". |
|
1118 * |
|
1119 * Corresponds to C11 atomic_thread_fence(memory_order_acquire) |
|
1120 * (an "acquire fence"). |
|
1121 * |
|
1122 * A pure LoadLoad fence is not provided, since the addition of LoadStore |
|
1123 * is almost always desired, and most current hardware instructions that |
|
1124 * provide a LoadLoad barrier also provide a LoadStore barrier for free. |
1116 * @since 1.8 |
1125 * @since 1.8 |
1117 */ |
1126 */ |
1118 public native void loadFence(); |
1127 public native void loadFence(); |
1119 |
1128 |
1120 /** |
1129 /** |
1121 * Ensures lack of reordering of stores before the fence |
1130 * Ensures that loads and stores before the fence will not be reordered with |
1122 * with loads or stores after the fence. |
1131 * stores after the fence; a "StoreStore plus LoadStore barrier". |
|
1132 * |
|
1133 * Corresponds to C11 atomic_thread_fence(memory_order_release) |
|
1134 * (a "release fence"). |
|
1135 * |
|
1136 * A pure StoreStore fence is not provided, since the addition of LoadStore |
|
1137 * is almost always desired, and most current hardware instructions that |
|
1138 * provide a StoreStore barrier also provide a LoadStore barrier for free. |
1123 * @since 1.8 |
1139 * @since 1.8 |
1124 */ |
1140 */ |
1125 public native void storeFence(); |
1141 public native void storeFence(); |
1126 |
1142 |
1127 /** |
1143 /** |
1128 * Ensures lack of reordering of loads or stores before the fence |
1144 * Ensures that loads and stores before the fence will not be reordered |
1129 * with loads or stores after the fence. |
1145 * with loads and stores after the fence. Implies the effects of both |
|
1146 * loadFence() and storeFence(), and in addition, the effect of a StoreLoad |
|
1147 * barrier. |
|
1148 * |
|
1149 * Corresponds to C11 atomic_thread_fence(memory_order_seq_cst). |
1130 * @since 1.8 |
1150 * @since 1.8 |
1131 */ |
1151 */ |
1132 public native void fullFence(); |
1152 public native void fullFence(); |
1133 |
1153 |
1134 /** |
1154 /** |