pthread_setspecific(3-thr) pthread_setspecific(3-thr)
NAME
pthreadsetspecific - sets the thread-specific data associated with
the specified key for the current thread
SYNOPSIS
#include <pthread.h>
int pthreadsetspecific(
pthreadkeyt key,
pthreadaddrt value);
PARAMETERS
key Context key value that uniquely identifies the context value
specified in value. This key value must have been obtained
from pthreadkeycreate().
value Address containing data to be associated with the specified
key for the current thread; this is the thread-specific
data.
DESCRIPTION
The pthreadsetspecific() routine sets the thread-specific data asso-
ciated 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 sub-
stituted 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:
EINVAL The key value is invalid.
SEE ALSO
pthreadgetspecific(3-thr), pthreadkeycreate(3-thr).
Page 1 Reliant UNIX 5.44 Printed 11/98