Skip to content

Commit bc05e6b

Browse files
committed
clarify no_data_race_after_complete test
1 parent 2b5b4e0 commit bc05e6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/pass/concurrency/windows_init_once.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ fn no_data_race_after_complete() {
148148
let reader = thread::spawn(move || unsafe {
149149
let mut pending = 0;
150150

151+
// this doesn't block because reader only executes after `InitOnceComplete` is called
151152
assert_eq!(InitOnceBeginInitialize(init_once_ptr.0, 0, &mut pending, null_mut()), TRUE);
152153
assert_eq!(pending, FALSE);
153154
// this should not data race
@@ -162,9 +163,8 @@ fn no_data_race_after_complete() {
162163
unsafe {
163164
assert_eq!(InitOnceComplete(init_once_ptr.0, 0, null_mut()), TRUE);
164165
}
165-
//println!("complete");
166166

167-
// run reader
167+
// run reader (without preemption, it has not taken a step yet)
168168
assert_eq!(reader.join().unwrap(), 1);
169169
}
170170

0 commit comments

Comments
 (0)