rust/tests/run-pass/thread-local-no-dtor.rs

19 lines
339 B
Rust
Raw Normal View History

//ignore-windows
2017-05-30 12:41:22 -05:00
#![feature(libc)]
extern crate libc;
use std::mem;
pub type Key = libc::pthread_key_t;
pub unsafe fn create(dtor: Option<unsafe extern fn(*mut u8)>) -> Key {
let mut key = 0;
assert_eq!(libc::pthread_key_create(&mut key, mem::transmute(dtor)), 0);
key
}
fn main() {
let _ = unsafe { create(None) };
}