tss_delete — thread-specific data key deletion
#include <threads.h>
void tss_delete(tss_t key);
[CX] The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1-2024 defers to the ISO C standard.The tss_delete() function shall release any resources used by the thread-specific storage identified by key. The thread-specific data values associated with key need not be null at the time tss_delete() is called. It is the responsibility of the application to free any application storage or perform any cleanup actions for data structures related to the deleted key or associated thread-specific data in any threads; this cleanup can be done either before or after tss_delete() is called.
The application shall ensure that the tss_delete() function is only called with a value for key that was returned by a call to tss_create() before the thread commenced executing destructors.
If tss_delete() is called while another thread is executing destructors, whether this will affect the number of invocations of the destructor associated with key on that thread is unspecified.
The tss_delete() function shall be callable from within destructor functions. Calling tss_delete() shall not result in the invocation of any destructors. Any destructor function that was associated with key shall no longer be called upon thread exit.
Any attempt to use key following the call to tss_delete() results in undefined behavior.
[CX] The tss_delete() function shall not be affected if the calling thread executes a signal handler during the call.
This function shall not return a value.
No errors are defined.
None.
None.
A thread-specific data key deletion function has been included in order to allow the resources associated with an unused thread-specific data key to be freed. Unused thread-specific data keys can arise, among other scenarios, when a dynamically loaded module that allocated a key is unloaded.
Conforming applications are responsible for performing any cleanup actions needed for data structures associated with the key to be deleted, including data referenced by thread-specific data values. No such cleanup is done by tss_delete(). In particular, destructor functions are not called. See the RATIONALE for pthread_key_delete for the reasons for this division of responsibility.
The tss_delete() function is not affected by signal handlers for the reasons stated in XRAT B.2.3 Error Numbers .
None.
pthread_key_delete , tss_create
XBD <threads.h>
First released in Issue 8. Included for alignment with the ISO/IEC 9899:2018 standard.
return to top of page