thr_setspecific

Associates the specified value with the specified key for the calling context.

Library:LibC
Classification:UNIX International
Service:Threads

Syntax

  #include <thread.h> 
   
  int thr_setspecific (
     thread_key_t   key,
     void          *value);
  

Parameters

key

(IN) Specifies the key for which the value is to be set.

value

(IN) Points to the value to be associated with the specified key. NULL is the default initial value that is associated with each thread for an allocated key.

Return Values

If successful, returns 0; otherwise, returns a nonzero error code:

Decimal

Constant

Description

9

EINVAL

The specified key is not allocated.

14

ERANGE

The specified key is invalid (out of range).

Remarks

The value set by calling thr_setspecific can be returned later by calling thr_getspecific.

See Also