Update mutex-locking-and-unlocking.md

Add missing memory fence.
pull/409/head
python-ast-person 2 years ago committed by GitHub
parent b5e582f58d
commit f40087cbfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,6 +29,9 @@ Locking and unlocking is simple with our layout; Make sure the mutex is in the c
).is_err{ ).is_err{
panic!("Unlock called while the lock was not locked") panic!("Unlock called while the lock was not locked")
}; };
fence(Ordering::Acquire);//prevent writes to the data protected by the mutex
//from being reordered before the mutex is actually acquired.
} }
} }

Loading…
Cancel
Save