Skip to content

Commit cff4ef4

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

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

examples/other_thread.rs

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

6+
#[cfg(all(windows, not(target_vendor = "uwp")))]
57
fn worker() {
68
foo();
79
}
10+
11+
#[cfg(all(windows, not(target_vendor = "uwp")))]
812
fn foo() {
913
bar()
1014
}
15+
16+
#[cfg(all(windows, not(target_vendor = "uwp")))]
1117
fn bar() {
1218
baz()
1319
}
20+
21+
#[cfg(all(windows, not(target_vendor = "uwp")))]
1422
fn baz() {
1523
println!("Hello from thread!");
1624
// Sleep for simple sync. Can't read thread that has finished running
17-
//std::thread::sleep(std::time::Duration::from_millis(1000));
25+
std::thread::sleep(std::time::Duration::from_millis(1000));
1826
loop {
1927
print!("");
2028
}
2129
}
2230

31+
#[cfg(all(windows, not(target_vendor = "uwp")))]
2332
fn main() {
2433
let thread = std::thread::spawn(|| {
2534
worker();
@@ -41,3 +50,8 @@ fn main() {
4150
bt.resolve();
4251
println!("{:?}", bt);
4352
}
53+
54+
#[cfg(not(all(windows, not(target_vendor = "uwp"))))]
55+
fn main() {
56+
println!("This example is skipped on non Windows platforms");
57+
}

0 commit comments

Comments
 (0)