1 #![allow(dead_code)] // not used on all platforms
5 pub type Key = libc::pthread_key_t;
8 pub unsafe fn create(dtor: Option<unsafe extern "C" fn(*mut u8)>) -> Key {
10 assert_eq!(libc::pthread_key_create(&mut key, mem::transmute(dtor)), 0);
15 pub unsafe fn set(key: Key, value: *mut u8) {
16 let r = libc::pthread_setspecific(key, value as *mut _);
17 debug_assert_eq!(r, 0);
21 pub unsafe fn get(key: Key) -> *mut u8 {
22 libc::pthread_getspecific(key) as *mut u8
26 pub unsafe fn destroy(key: Key) {
27 let r = libc::pthread_key_delete(key);
28 debug_assert_eq!(r, 0);