]>
git.saurik.com Git - apple/libpthread.git/blob - tests/tsd.c
7 void destructor(void *value
)
12 void *thread(void *param
)
16 pthread_key_t key
= *(pthread_key_t
*)param
;
17 res
= pthread_setspecific(key
, (void *)0x12345678);
19 void *value
= pthread_getspecific(key
);
22 res
= pthread_key_create(&key
, NULL
);
24 res
= pthread_setspecific(key
, (void *)0x55555555);
30 int main(int argc
, char *argv
[])
35 res
= pthread_key_create(&key
, destructor
);
37 printf("key = %ld\n", key
);
40 res
= pthread_create(&p
, NULL
, thread
, &key
);
44 res
= pthread_join(p
, &value
);
45 printf("value = %p\n", value
);
46 printf("ptr = %p\n", ptr
);
50 res
= pthread_key_delete(key
);