-
-
Save quininer/2063c31b0bc1753989122e782b182bea to your computer and use it in GitHub Desktop.
localtime_r and setenv data race
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use chrono::prelude::*; | |
fn main() { | |
let j = std::thread::spawn(|| { | |
for i in 0..910000 { | |
std::env::set_var(format!("TEST{}", i), i.to_string()); | |
} | |
}); | |
for i in 0..910000 { | |
println!("{} - {}", i, Local::now()); | |
} | |
j.join().unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment