#include <pthread.h>
|
|
void *
pthread_getspecific (pthread_key_t key); |
The effect of calling pthread_getspecific with a key value not obtained from pthread_key_create or after key has been deleted with pthread_key_delete is undefined.
The pthread_getspecific function may be called from a thread-specific data destructor function.
pthread_key_t keys;
void* rc;
if(pthread_key_create(&keys, NULL) != 0)
{
printf("Error: pthread_key_create() failed0);
return -1;
} else
{
if(pthread_setspecific(keys, (void *)(long)(100)) != 0)
{
printf("Error: pthread_setspecific() failed\n");
return -1;
}
}
rc = pthread_getspecific(keys);
if(rc != (void *)(long)(100))
{
printf("getspecific failed \n");
return -1;
}
|
© 2005-2007 Nokia |