]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/sync/libc_pthread_mutex_normal_deadlock.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-fail / sync / libc_pthread_mutex_normal_deadlock.rs
1 // ignore-windows: No libc on Windows
2
3 #![feature(rustc_private)]
4
5 extern crate libc;
6
7 fn main() {
8     unsafe {
9         let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();
10         assert_eq!(libc::pthread_mutexattr_settype(&mut mutexattr as *mut _, libc::PTHREAD_MUTEX_NORMAL), 0);
11         let mut mutex: libc::pthread_mutex_t = std::mem::zeroed();
12         assert_eq!(libc::pthread_mutex_init(&mut mutex as *mut _, &mutexattr as *const _), 0);
13         assert_eq!(libc::pthread_mutex_lock(&mut mutex as *mut _), 0);
14         libc::pthread_mutex_lock(&mut mutex as *mut _); //~ ERROR deadlock
15     }
16 }