Skip to content

Instantly share code, notes, and snippets.

@quininer
Last active September 16, 2022 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quininer/2063c31b0bc1753989122e782b182bea to your computer and use it in GitHub Desktop.
Save quininer/2063c31b0bc1753989122e782b182bea to your computer and use it in GitHub Desktop.
localtime_r and setenv data race
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