HTL_thread_setspecific
Sets the value of the thread private variable.
Interface Definition
int HTL_thread_setspecific(HTL_thread_key_t thread_key, const void *value);
Description
HTL_thread_setspecific() is used to associate the thread private variable thread_key with its value value. Different threads can associate the same thread private variable to different values.
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
thread_key |
HTL_thread_key_t |
Handle to the thread private variable. |
Input |
value |
void * |
Value. |
Input |
Return Value
- HTL_THREAD_SUCCESS: success.
- Other values: failure. For details, see the error code descriptions.
Example
1 2 3 | static HTL_thread_key_t tls[NUM_TLS]; int j; ret = HTL_thread_setspecific(tls[j], (void *)(intptr_t)j); |
Parent topic: Thread Functions