pthread_key_delete() — Delete thread-specific data key
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
Single UNIX Specification, version 3 |
both | z/OS V1R7 |
Format
#define _OPEN_THREADS 2
#include <pthread.h>
int pthread_key_delete(pthread_key_t key);
General description
pthread_key_delete() deletes thread-specific data keys created with pthread_key_create(). The thread-specific data values associated with key do not need to be NULL when the key is deleted. The application is responsible for freeing any storage or cleaning up data structures referring to thread-specific data associated with the deleted key in any thread. After key has been deleted, passing it to any function taking a thread-specific data key results in undefined behavior.
pthread_key_delete() can be called from destructor functions. Calling pthread_key_delete() will not cause any destructor functions to be invoked. Any destructor function associated with key when it was created will not be called on thread exit after key has been deleted.
Returned value
- Error Code
- Description
- EINVAL
- The key value is invalid.
Related information
- pthread.h
- pthread_getspecific() — Get the thread-specific value for a key
- pthread_getspecific_d8_np() — Get the thread-specific value for a key
- pthread_key_create() — Create thread-specific data key
- pthread_setspecific() — Set the thread-specific value for a key
- unsetenv() — Delete an environment variable