OpenJDK / jdk / hs
changeset 29715:ca3f43a932cf
8074578: Document memory visibility effects of Unsafe compareAndSwap methods
Reviewed-by: psandoz, jrose, dholmes
author | martin |
---|---|
date | Wed, 04 Mar 2015 17:35:40 -0800 |
parents | afac043e9bf0 |
children | 838a9156720c |
files | jdk/src/java.base/share/classes/sun/misc/Unsafe.java |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Tue Mar 10 14:23:03 2015 -0700 +++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Wed Mar 04 17:35:40 2015 -0800 @@ -631,6 +631,10 @@ /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. + * + * <p>This operation has memory semantics of a {@code volatile} read + * and write. Corresponds to C11 atomic_compare_exchange_strong. + * * @return {@code true} if successful */ public final native boolean compareAndSwapObject(Object o, long offset, @@ -640,6 +644,10 @@ /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. + * + * <p>This operation has memory semantics of a {@code volatile} read + * and write. Corresponds to C11 atomic_compare_exchange_strong. + * * @return {@code true} if successful */ public final native boolean compareAndSwapInt(Object o, long offset, @@ -649,6 +657,10 @@ /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. + * + * <p>This operation has memory semantics of a {@code volatile} read + * and write. Corresponds to C11 atomic_compare_exchange_strong. + * * @return {@code true} if successful */ public final native boolean compareAndSwapLong(Object o, long offset,