2022-07-08 11:08:32 -05:00
|
|
|
//@ignore-windows: No libc on Windows
|
2020-05-24 13:29:56 -05:00
|
|
|
//
|
|
|
|
// Check that if we do not set the mutex type, it is the default.
|
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
|
|
|
|
extern crate libc;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();
|
|
|
|
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_lock(&mut mutex as *mut _); //~ ERROR: Undefined Behavior: trying to acquire already locked default mutex
|
2020-05-24 13:29:56 -05:00
|
|
|
}
|
|
|
|
}
|