2022-07-17 20:54:10 -05:00
|
|
|
//@ignore-target-windows: No libc on Windows
|
2020-04-05 14:55:57 -05:00
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();
|
2022-06-21 13:27:44 -05:00
|
|
|
assert_eq!(
|
|
|
|
libc::pthread_mutexattr_settype(&mut mutexattr as *mut _, libc::PTHREAD_MUTEX_NORMAL),
|
2022-06-21 13:28:00 -05:00
|
|
|
0,
|
2022-06-21 13:27:44 -05:00
|
|
|
);
|
2020-04-05 14:55:57 -05:00
|
|
|
let mut mutex: libc::pthread_mutex_t = std::mem::zeroed();
|
|
|
|
assert_eq!(libc::pthread_mutex_init(&mut mutex as *mut _, &mutexattr as *const _), 0);
|
|
|
|
assert_eq!(libc::pthread_mutex_lock(&mut mutex as *mut _), 0);
|
2022-07-11 06:44:55 -05:00
|
|
|
libc::pthread_mutex_destroy(&mut mutex as *mut _); //~ ERROR: destroyed a locked mutex
|
2020-04-05 14:55:57 -05:00
|
|
|
}
|
|
|
|
}
|