mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
fix DOWNGRADED
bit unpreserved
Co-authored-by: Jonas Böttiger <jonasboettiger@icloud.com>
This commit is contained in:
parent
84fd95cbed
commit
782b07e1ff
@ -558,7 +558,7 @@ fn test_downgrade_atomic() {
|
||||
// modify the protected value.
|
||||
|
||||
// `W` is the number of evil writer threads.
|
||||
const W: usize = if cfg!(target_pointer_width = "64") { 100 } else { 20 };
|
||||
const W: usize = 20;
|
||||
let rwlock = Arc::new(RwLock::new(0));
|
||||
|
||||
// Spawns many evil writer threads that will try and write to the locked value before the
|
||||
|
@ -395,9 +395,9 @@ impl RwLock {
|
||||
node.next.0 = AtomicPtr::new(state.mask(NODE_MASK).cast());
|
||||
node.prev = AtomicLink::new(None);
|
||||
|
||||
// Set the `QUEUED` bit and maintain the `LOCKED` bit.
|
||||
// Set the `QUEUED` bit and preserve the `LOCKED` and `DOWNGRADED` bit.
|
||||
let mut next = ptr::from_ref(&node)
|
||||
.map_addr(|addr| addr | QUEUED | (state.addr() & LOCKED))
|
||||
.map_addr(|addr| addr | QUEUED | (state.addr() & (DOWNGRADED | LOCKED)))
|
||||
as State;
|
||||
|
||||
let mut is_queue_locked = false;
|
||||
|
Loading…
Reference in New Issue
Block a user