We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8a562f9 + f8a2f31 commit c40cfcfCopy full SHA for c40cfcf
library/std/tests/env.rs
@@ -5,6 +5,7 @@ use rand::distributions::{Alphanumeric, DistString};
5
6
mod common;
7
use common::test_rng;
8
+use std::thread;
9
10
#[track_caller]
11
fn make_rand_name() -> OsString {
@@ -140,3 +141,22 @@ fn env_home_dir() {
140
141
}
142
143
144
+
145
+#[test] // miri shouldn't detect any data race in this fn
146
+#[cfg_attr(any(not(miri), target_os = "emscripten"), ignore)]
147
+fn test_env_get_set_multithreaded() {
148
+ let getter = thread::spawn(|| {
149
+ for _ in 0..100 {
150
+ let _ = var_os("foo");
151
+ }
152
+ });
153
154
+ let setter = thread::spawn(|| {
155
156
+ set_var("foo", "bar");
157
158
159
160
+ let _ = getter.join();
161
+ let _ = setter.join();
162
+}
0 commit comments