pthread_setspecific(3P) pthread_setspecific(3P)
pthread_setspecific, pthread_getspecific - thread-specific data
management
#include <pthread.h>
int pthread_setspecific(pthread_key_t key, const void *value);
void *pthread_getspecific(pthread_key_t key);
The pthread_setspecific() function associates a thread-specific value
with key. Different threads may bind different values to the same key.
The pthread_getspecific() function returns the calling thread's value
that is bound to the specified key.
The affect of calling either of these functions using a value for key not
obtained from a pthread_key_create() call or after key has been deleted
with pthread_key_delete() is undefined.
The pthread_getspecific() function returns the thread-specific value
associated with key. If no value is associated with key, then NULL is
returned.
On success, pthread_setspecific() returns zero; otherwise, an error
number is returned:
[ENOMEM] Not enough memory is available to associate value with
key.
[EINVAL] The value specified by key is invalid.
pthread_key_create(3P), pthread_key_delete(3P).
PPPPaaaaggggeeee 1111 [ Back ]
|