| 1 |
use nix::sys::pthread::*; |
| 2 |
|
| 3 |
#[cfg(any( |
| 4 |
target_env = "musl", |
| 5 |
target_os = "redox", |
| 6 |
target_env = "ohos", |
| 7 |
target_os = "cygwin" |
| 8 |
))] |
| 9 |
#[test] |
| 10 |
fn test_pthread_self() { |
| 11 |
let tid = pthread_self(); |
| 12 |
assert!(!tid.is_null()); |
| 13 |
} |
| 14 |
|
| 15 |
#[cfg(not(any( |
| 16 |
target_env = "musl", |
| 17 |
target_os = "redox", |
| 18 |
target_env = "ohos", |
| 19 |
target_os = "cygwin" |
| 20 |
)))] |
| 21 |
#[test] |
| 22 |
fn test_pthread_self() { |
| 23 |
let tid = pthread_self(); |
| 24 |
assert_ne!(tid, 0); |
| 25 |
} |
| 26 |
|
| 27 |
#[test] |
| 28 |
#[cfg(not(target_os = "redox"))] |
| 29 |
fn test_pthread_kill_none() { |
| 30 |
pthread_kill(pthread_self(), None) |
| 31 |
.expect("Should be able to send signal to my thread."); |
| 32 |
} |