pthread_setspecific(3)
NAME
pthread_setspecific - Sets the thread-specific data associated with the specified key for the current thread
SYNOPSIS
#include <pthread.h> int pthread_setspecific( pthread_key_t key, pthread_addr_t value);
PARAMETERS
keyContext key value that uniquely identifies the context value specified in value. This key value must have been obtained from pthread_keycreate().
valueAddress containing data to be associated with the specified key for the current thread; this is the thread-specific data.
DESCRIPTION
The pthread_setspecific() routine sets the thread-specific data associated with the specified key for the current thread. If a value has already been defined for the key in this thread, the new value is substituted for it. Different threads can bind different values to the same key. These values are typically pointers to blocks of dynamically allocated memory that are reserved for use by the calling thread.
RETURN VALUES
If the function fails, -1 is returned, and errno may be set to the following value:
| Return | Error | Description |
| \-1 | [EINVAL] | The key value is invalid. |
RELATED INFORMATION
Functions: pthread_getspecific(3), pthread_keycreate(3).
Hewlett-Packard Company — OSF DCE 1.1/HP DCE 1.5