PTHREADSETSPECIFIC(3) BSD Library Functions Manual PTHREADSETSPECIFIC(3)
NAME
pthreadsetspecific -- set a thread-specific data value
SYNOPSIS
##include <>
int
pthreadsetspecific(pthreadkeyt key, const void *value);
DESCRIPTION
The pthreadsetspecific() function associates a thread-specific value
with a key obtained via a previous call to pthreadkeycreate(). Differ-
ent threads man 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 effect of calling pthreadsetspecific() with a key value not obtained
from pthreadkeycreate() or after key has been deleted with
pthreadkeydelete() is undefined.
pthreadsetspecific() may be called from a thread-specific data destruc-
tor function, however this may result in lost storage or infinite loops.
RETURN VALUES
If successful, the pthreadsetspecific() function will return zero.
Otherwise an error number will be returned to indicate the error.
ERORS
pthreadsetspecific() will fail if:
[ENOMEM] Insufficient memory exists to associate the value with
the key.
[EINVAL] The key value is invalid.
SEE ALSO
pthreadgetspecific(3), pthreadkeycreate(3), pthreadkeydelete(3)
STANDARDS
pthreadsetspecific() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
BSD April 4, 1996 BSD
|