Skip to content

Commit

Permalink
is_abandoned() test: add fence
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed May 26, 2024
1 parent d995775 commit c17b01b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,8 @@ jobs:
- name: Run ThreadSanitizer
env:
RUSTFLAGS: "-Z sanitizer=thread"
# "no_race_with_is_abandoned" is skipped because ThreadSanitizer
# reports false positives when using standalone fences,
# see https://github.com/google/sanitizers/issues/1415.
run: |
cargo test --tests -Z build-std --target x86_64-unknown-linux-gnu
cargo test --tests -Z build-std --target x86_64-unknown-linux-gnu -- --skip no_race_with_is_abandoned
1 change: 1 addition & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ fn no_race_with_is_abandoned() {
});
std::thread::yield_now();
if c.is_abandoned() {
std::sync::atomic::fence(std::sync::atomic::Ordering::Acquire);
unsafe { V = 20 };
}
t.join().unwrap();
Expand Down

0 comments on commit c17b01b

Please sign in to comment.