JDK 17 | JDK 21 |
---|---|
17.0.11Fixed | 21 b21Fixed |
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
We need an Atomic version of setting bits, e.g. and/or/xor, like the one in accessFlags for general purpose use. From [~jrose] Suggestions for API shape: Mimic whatever the intel intrinsics do for and/or/xor/add. Prefer their names. But, stay within the boundaries of what the C++ atomic API does (omit op-and-fetch, keep only fetch-and-op). Use their names if it makes sense. Key requirement: Have the return value contain enough information to infer the previous state of the variable, for those who care. Key requirement: Robustly support “set one bit” and “clear one bit”, probably by logior and logand of multi-bit masks. Higher-level bit setter could be update_bits(T bits, bool new_state) -> T old_bits. The higher-level setter could use the optimization of not issuing a CAS if the bit (or bits) is (are) in the desired new state already.
|