pthread_key_create(3P)

pthread_key_create - thread-specific data key creation

As shipped in IRIX 6.5.15. Unchanged since IRIX 6.5.

NAME
     pthread_key_create - thread-specific data key creation

C SYNOPSIS
     #include <pthread.h>

     int pthread_key_create(pthread_key_t *key, void (*destructor)(void *));

DESCRIPTION
     The pthread_key_create() function creates a key that can be used by all
     threads in the process to get and set thread-specific data.  The newly
     created key is returned in the memory pointed to by key.

     After a new key is created, all active threads have the value NULL
     associated with that key.  After a new thread is created, the value NULL
     is associated with all keys for that thread.

     An optional destructor function may be associated with each key.  Upon
     thread exit [see pthread_exit()], if a key has a non-NULL destructor
     pointer and has a non-NULL value associated with that key, then the
     destructor function will be called with the associated value.  The order
     of destructor calls is unspecified.

     If, after the destructor functions have been called for all non-NULL key
     values with associated destructor functions, there are still some non-
     NULL key values with associated destructor functions, then the process
     will be repeated.  This loop will continue until no non-NULL key values
     with associated destructor functions exist.

DIAGNOSTICS
     On success, pthread_key_create() returns zero; otherwise, an error number
     is returned:

     [EAGAIN]       The limit on the total number of keys per process has been
                    exceeded [see NOTES].

SEE ALSO
     pthread_setspecific(3P), pthread_getspecific(3P), pthread_key_delete(3P),
     pthread_exit(3P), sysconf(3C).

NOTES
     The key limit can be obtained from sysconf() using the THREAD_KEYS_MAX
     option.