cs431_homework/test/loom.rs
1//! Re-exports loom if `feature = "check-loom"`. Otherwise, std.
2
3#[cfg(not(feature = "check-loom"))]
4pub use std::*;
5
6#[cfg(feature = "check-loom")]
7pub use loom::*;
8
9/// Run `f` with `loom::model` if compiled with `check-loom` feature.
10pub fn model<F: Fn() + Sync + Send + 'static>(f: F) {
11 cfg_if::cfg_if! {
12 if #[cfg(feature = "check-loom")] {
13 loom::model(f)
14 } else {
15 f()
16 }
17 }
18}