Skip to content

Commit 587fa9a

Browse files
committed
test: make the other_thread example noop on other platforms
1 parent 897795e commit 587fa9a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

examples/other_thread.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1-
// Windows only currently
21
use backtrace::{Backtrace, BacktraceFrame};
2+
#[cfg(all(windows, not(target_vendor = "uwp")))]
33
use std::os::windows::prelude::AsRawHandle;
44

5+
#[cfg(all(windows, not(target_vendor = "uwp")))]
56
fn worker() {
67
foo();
78
}
9+
10+
#[cfg(all(windows, not(target_vendor = "uwp")))]
811
fn foo() {
912
bar()
1013
}
14+
15+
#[cfg(all(windows, not(target_vendor = "uwp")))]
1116
fn bar() {
1217
baz()
1318
}
19+
20+
#[cfg(all(windows, not(target_vendor = "uwp")))]
1421
fn baz() {
1522
println!("Hello from thread!");
1623
// Sleep for simple sync. Can't read thread that has finished running
17-
//std::thread::sleep(std::time::Duration::from_millis(1000));
24+
std::thread::sleep(std::time::Duration::from_millis(1000));
1825
loop {
1926
print!("");
2027
}
2128
}
2229

30+
#[cfg(all(windows, not(target_vendor = "uwp")))]
2331
fn main() {
2432
let thread = std::thread::spawn(|| {
2533
worker();
@@ -41,3 +49,8 @@ fn main() {
4149
bt.resolve();
4250
println!("{:?}", bt);
4351
}
52+
53+
#[cfg(not(all(windows, not(target_vendor = "uwp"))))]
54+
fn main() {
55+
println!("This example is skipped on non Windows platforms");
56+
}

0 commit comments

Comments
 (0)