Obtains the per-thread context associated with the specified key.
Syntax
pthread_getspecific(
key,
value );
Argument Data Type Access
key opaque pthread_key_t read
value opaque pthread_addr_t write
C Binding
int
pthread_getspecific (
pthread_key_t key,
pthread_addr_t *value);
Arguments
- key
- Context key value that identifies the context value obtained.
This key value must be obtained from pthread_keycreate.
- value
- Address of the current per-thread context value associated with
the specified key.
Description
This routine obtains the per-thread context associated with
the specified key for the current thread. If a context has not
been defined for the key (that is, pthread_setspecific has not been
successfully executed), NULL is returned in value.
Return Values
If an error condition occurs, this routine returns -1 and sets
errno to the corresponding error value. Possible return
values are as follows:
Return Error Description
0 Successful completion.
-1 [EINVAL] The key value is invalid.