45 new_flags = old_flags & ~bits; |
45 new_flags = old_flags & ~bits; |
46 f = Atomic::cmpxchg(new_flags, &_flags, old_flags); |
46 f = Atomic::cmpxchg(new_flags, &_flags, old_flags); |
47 } while(f != old_flags); |
47 } while(f != old_flags); |
48 } |
48 } |
49 |
49 |
|
50 // Returns true iff this thread succeeded setting the bit. |
|
51 bool AccessFlags::atomic_set_one_bit(jint bit) { |
|
52 // Atomically update the flags with the bit given |
|
53 jint old_flags, new_flags, f; |
|
54 bool is_setting_bit = false; |
|
55 do { |
|
56 old_flags = _flags; |
|
57 new_flags = old_flags | bit; |
|
58 is_setting_bit = old_flags != new_flags; |
|
59 f = Atomic::cmpxchg(new_flags, &_flags, old_flags); |
|
60 } while(f != old_flags); |
|
61 |
|
62 return is_setting_bit; |
|
63 } |
|
64 |
50 #if !defined(PRODUCT) || INCLUDE_JVMTI |
65 #if !defined(PRODUCT) || INCLUDE_JVMTI |
51 |
66 |
52 void AccessFlags::print_on(outputStream* st) const { |
67 void AccessFlags::print_on(outputStream* st) const { |
53 if (is_public ()) st->print("public " ); |
68 if (is_public ()) st->print("public " ); |
54 if (is_private ()) st->print("private " ); |
69 if (is_private ()) st->print("private " ); |