thr_setspecific(3thread) thr_setspecific(3thread)
NAME
thr_setspecific - set thread-specific data
SYNOPSIS
cc [options] -Kthread file
#include <thread.h>
int thr_setspecific(thread_key_t key, void *value);
Parameters
key key to which value is to be bound
value pointer to thread-specific data, or NULL
DESCRIPTION
thr_setspecific associates a thread-specific value with key.
Different threads may bind different values to the same key.
If the value bound to key must be updated during the lifetime
of the thread, the caller must release the storage associated
with the old value before a new value is bound, or the storage
is lost.
key Parameter
key is a key obtained with a previous call to
thr_keycreate(3thread).
The effect of calling thr_setspecific with a key value not
obtained with thr_keycreate or after key has been deleted with
thr_keydelete is undefined.
value Parameter
value is typically a pointer to blocks of dynamically-
allocated memory that have been reserved for use by the
calling thread. If value is NULL, the calling thread will
give up a non-NULL reference to key.
Return Values
thr_setspecific returns zero for success and an error number
for failure, as described below.
Errors
If any of the following conditions is detected,
thr_setspecific returns the corresponding value:
Copyright 1994 Novell, Inc. Page 1
thr_setspecific(3thread) thr_setspecific(3thread)
EINVAL The key value is invalid.
ENOMEM There is not sufficient memory available to establish
the binding.
REFERENCES
thr_getspecific(3thread), thr_keycreate(3thread),
thr_keydelete(3thread), thread(3thread)
Copyright 1994 Novell, Inc. Page 2