rust/tests/compile-fail/libc_pthread_rwlock_write_write_deadlock.rs
2020-04-05 13:25:49 -05:00

14 lines
324 B
Rust

// ignore-windows: No libc on Windows
#![feature(rustc_private)]
extern crate libc;
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
}
}