PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run --bin t Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target\debug\t.exe` R:100000000 r:24134332 PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run --bin t Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target\debug\t.exe` R:100000000 r:24366177 PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run -r --bin t Finished release [optimized] target(s) in 0.01s Running `target\release\t.exe` R:100000000 r:10000004 PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run -r --bin t Finished release [optimized] target(s) in 0.01s Running `target\release\t.exe` R:100000000 r:10000004
abc@310a0ca1fb3d:~/workspace/t/src$ cargo run --bin t Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `/config/workspace/t/target/debug/t` R:100000000 r:74990565 abc@310a0ca1fb3d:~/workspace/t/src$ cargo run --bin t Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `/config/workspace/t/target/debug/t` R:100000000 r:74348213 abc@310a0ca1fb3d:~/workspace/t/src$ cargo run -r --bin t Compiling t v0.1.0 (/config/workspace/t) Finished release [optimized] target(s) in 2.51s Running `/config/workspace/t/target/release/t` R:100000000 r:10000004 abc@310a0ca1fb3d:~/workspace/t/src$ cargo run -r --bin t Finished release [optimized] target(s) in 0.01s Running `/config/workspace/t/target/release/t` R:100000000 r:10000004
PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run --bin t1 Compiling t v0.1.0 (C:\Users\rivers\Desktop\AtomicVariableDemo-master) Finished dev [unoptimized + debuginfo] target(s) in 0.59s Running `target\debug\t1.exe` PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run --bin t2 Compiling t v0.1.0 (C:\Users\rivers\Desktop\AtomicVariableDemo-master) Finished dev [unoptimized + debuginfo] target(s) in 0.52s Running `target\debug\t2.exe` PS C:\Users\rivers\Desktop\AtomicVariableDemo-master> cargo run --bin t3 Compiling t v0.1.0 (C:\Users\rivers\Desktop\AtomicVariableDemo-master) Finished dev [unoptimized + debuginfo] target(s) in 0.51s Running `target\debug\t3.exe`
而Aarch64下, 稍稍等一会(我这里跑了3分钟), 就可以看到t1, t2出现了异常值:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
abc@310a0ca1fb3d:~/workspace/t/src$ cargo run --bin t1 Compiling t v0.1.0 (/config/workspace/t) Finished dev [unoptimized + debuginfo] target(s) in 1.60s Running `/config/workspace/t/target/debug/t1` Get! V1.0=0 ^C abc@310a0ca1fb3d:~/workspace/t/src$ cargo run --bin t2 Compiling t v0.1.0 (/config/workspace/t) Finished dev [unoptimized + debuginfo] target(s) in 1.59s Running `/config/workspace/t/target/debug/t2` Get! V1.0=0 abc@310a0ca1fb3d:~/workspace/t/src$ cargo run --bin t3 Compiling t v0.1.0 (/config/workspace/t) Finished dev [unoptimized + debuginfo] target(s) in 1.61s Running `/config/workspace/t/target/debug/t3`