1.1 --- a/src/share/vm/utilities/accessFlags.cpp Mon Nov 03 12:02:40 2014 -0800 1.2 +++ b/src/share/vm/utilities/accessFlags.cpp Thu Oct 02 10:55:36 2014 +0200 1.3 @@ -62,6 +62,21 @@ 1.4 } while(f != old_flags); 1.5 } 1.6 1.7 +// Returns true iff this thread succeeded setting the bit. 1.8 +bool AccessFlags::atomic_set_one_bit(jint bit) { 1.9 + // Atomically update the flags with the bit given 1.10 + jint old_flags, new_flags, f; 1.11 + bool is_setting_bit = false; 1.12 + do { 1.13 + old_flags = _flags; 1.14 + new_flags = old_flags | bit; 1.15 + is_setting_bit = old_flags != new_flags; 1.16 + f = Atomic::cmpxchg(new_flags, &_flags, old_flags); 1.17 + } while(f != old_flags); 1.18 + 1.19 + return is_setting_bit; 1.20 +} 1.21 + 1.22 #if !defined(PRODUCT) || INCLUDE_JVMTI 1.23 1.24 void AccessFlags::print_on(outputStream* st) const {