Skip to content

Commit

Permalink
test: make other_thread example no-op on no-std
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jul 10, 2022
1 parent 0cd54c5 commit 97396dd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions examples/other_thread.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
use backtrace::{Backtrace, BacktraceFrame};
#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
use std::os::windows::prelude::AsRawHandle;

#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
fn worker() {
foo();
}

#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
fn foo() {
bar()
}

#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
fn bar() {
baz()
}

#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
fn baz() {
println!("Hello from thread!");
// Sleep for simple sync. Can't read thread that has finished running
Expand All @@ -28,7 +28,7 @@ fn baz() {
}
}

#[cfg(all(windows, not(target_vendor = "uwp")))]
#[cfg(all(windows, not(target_vendor = "uwp"), feature = "std"))]
fn main() {
let thread = std::thread::spawn(|| {
worker();
Expand All @@ -51,7 +51,7 @@ fn main() {
println!("{:?}", bt);
}

#[cfg(not(all(windows, not(target_vendor = "uwp"))))]
#[cfg(not(all(windows, not(target_vendor = "uwp"), feature = "std")))]
fn main() {
println!("This example is skipped on non Windows platforms");
println!("This example is skipped on non-Windows or no-std platforms");
}

0 comments on commit 97396dd

Please sign in to comment.