Manual adjustments
This commit is contained in:
parent
ee132c8d07
commit
fed5ea8b10
@ -16,7 +16,9 @@ pub fn main() {
|
|||||||
let b = &mut a as *mut AtomicUsize;
|
let b = &mut a as *mut AtomicUsize;
|
||||||
let c = EvilSend(b);
|
let c = EvilSend(b);
|
||||||
unsafe {
|
unsafe {
|
||||||
let j1 = spawn(move || *(c.0 as *mut usize));
|
let j1 = spawn(move || {
|
||||||
|
let _val = *(c.0 as *mut usize);
|
||||||
|
});
|
||||||
|
|
||||||
let j2 = spawn(move || {
|
let j2 = spawn(move || {
|
||||||
//Equivalent to: (&*c.0).store(32, Ordering::SeqCst)
|
//Equivalent to: (&*c.0).store(32, Ordering::SeqCst)
|
||||||
|
@ -13,7 +13,9 @@ pub fn main() {
|
|||||||
let b = &mut a as *mut u32;
|
let b = &mut a as *mut u32;
|
||||||
let c = EvilSend(b);
|
let c = EvilSend(b);
|
||||||
unsafe {
|
unsafe {
|
||||||
let j1 = spawn(move || *c.0);
|
let j1 = spawn(move || {
|
||||||
|
let _val = *c.0;
|
||||||
|
});
|
||||||
|
|
||||||
let j2 = spawn(move || {
|
let j2 = spawn(move || {
|
||||||
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 2) and Read on Thread(id = 1)
|
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 2) and Read on Thread(id = 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user