Skip to content

Commit

Permalink
clarify no_data_race_after_complete test
Browse files Browse the repository at this point in the history
  • Loading branch information
beepster4096 committed Nov 4, 2022
1 parent 2b5b4e0 commit bc05e6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/pass/concurrency/windows_init_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ fn no_data_race_after_complete() {
let reader = thread::spawn(move || unsafe {
let mut pending = 0;

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

// run reader
// run reader (without preemption, it has not taken a step yet)
assert_eq!(reader.join().unwrap(), 1);
}

Expand Down

0 comments on commit bc05e6b

Please sign in to comment.