NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO
$(OS_DIR)/lib/libpthreads.a #include <pthread.h>int pthread_setspecific(pthread_key_t key, const void * value);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The pthread_setspecific() function associates a thread-specific value with a key obtained via a previous call to pthread_key_create() . Different threads may bind different values to the same key. These values are typically pointers to blocks of dynamically allocated memory that have been reserved for use by the calling thread.
The pthread_getspecific() function returns the value currently bound to the specified key in the calling thread. This function is implemented as a macro. 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.
Both pthread_setspecific() and pthread_getspecific() may be called, either explicitly or implicitly, from a thread-specific data destructor function. Calling pthread_setspecific() from a destructor may result in lost storage.
The pthread_getspecific() function returns the thread-specific data value associated with the given key . If no thread-specific data value is associated with key in the calling thread, the value NULL is returned.
On successful completion, pthread_setspecific() returns zero. Otherwise, an error code is returned.
These calls do not set errno .
The following error codes apply only to pthread_setspecific() .
The key value is invalid.
There is insufficient memory to associate the value with the key.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO