rust/tests/compile-fail/libc_pthread_rwlock_read_write_deadlock.rs

14 lines
324 B
Rust
Raw Normal View History

2020-04-05 13:25:49 -05:00
// 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_rdlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
}
}