thr_setspecific(THREAD)
thr_setspecific --
set thread-specific data
Synopsis
cc [options] -Kthread file
#include <thread.h>
int thr_setspecific(thread_key_t key, void *value);
Description
thr_setspecific associates a thread-specific value
with key.
Different threads can 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.
Parameters
key-
key to which value is to be bound
value-
pointer to thread-specific data, or NULL
key parameter
key is a key obtained with a previous
call to
thr_keycreate(THREAD).
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.
Errors
If any of the following conditions is detected,
thr_setspecific returns the corresponding value:
EINVAL-
The key value is invalid.
ENOMEM-
There is not sufficient memory available to establish the binding.
References
Intro(THREAD),
thr_getspecific(THREAD),
thr_keycreate(THREAD),
thr_keydelete(THREAD)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005