thr_getspecific(3thread) thr_getspecific(3thread)
NAME
thr_getspecific - get thread-specific data
SYNOPSIS
cc [options] -Kthread file
#include <thread.h>
int thr_getspecific(thread_key_t key, void **value);
Parameters
key key whose value is to be returned
value pointer to a location in which thr_getspecific will
store the value associated by the calling thread with
the specified key.
DESCRIPTION
thr_getspecific obtains the value currently bound to the
specified key on behalf of the calling thread.
key Parameter
key is a key obtained with a previous call to
thr_keycreate(3thread).
The effect of calling thr_getspecific with a key value not
obtained with thr_keycreate or after key has been deleted with
thr_keydelete is undefined.
value Parameter
If a value is bound to the specified key by the calling
thread, that value is placed in the location pointed to by
value. If no value is bound to the specified key for the
calling thread, the location pointed to by value is set to
NULL.
Return Values
thr_getspecific returns zero for success and an error number
for failure as described below.
Errors
If any of the following conditions is detected,
thr_getspecific returns the corresponding value and the
contents of the location pointed to by value are unchanged:
EINVAL key is not a valid key.
Copyright 1994 Novell, Inc. Page 1
thr_getspecific(3thread) thr_getspecific(3thread)
USAGE
thr_getspecific is not guaranteed to detect an invalid key.
If thr_getspecific returns 0 and sets the location pointed to
by value to NULL, either no value is currently bound to key,
the value bound to key is NULL, or key is invalid. In this
case, the caller can determine whether key is invalid by
calling
thr_setspecific(key, NULL)
to get the applicable error number.
REFERENCES
thr_keycreate(3thread), thr_keydelete(3thread),
thr_setspecific(3thread), thread(3thread)
Copyright 1994 Novell, Inc. Page 2