File: test_pthread.rs

package info (click to toggle)
rust-nix 0.30.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,248 kB
  • sloc: ansic: 18; makefile: 7
file content (34 lines) | stat: -rw-r--r-- 679 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![cfg(feature = "pthread")]
use nix::sys::pthread::*;

#[cfg(any(
    target_env = "musl",
    target_os = "redox",
    target_env = "ohos",
    target_os = "cygwin"
))]
#[test]
fn test_pthread_self() {
    let tid = pthread_self();
    assert!(!tid.is_null());
}

#[cfg(not(any(
    target_env = "musl",
    target_os = "redox",
    target_env = "ohos",
    target_os = "cygwin"
)))]
#[test]
fn test_pthread_self() {
    let tid = pthread_self();
    assert_ne!(tid, 0);
}

#[test]
#[cfg(not(target_os = "redox"))]
#[cfg(feature = "signal")]
fn test_pthread_kill_none() {
    pthread_kill(pthread_self(), None)
        .expect("Should be able to send signal to my thread.");
}