p Multithreaded programs in C add the third group .Sy thread-specific storage . This data is private to thread and every entry of this type has an associated .Dv tss_t opaque key that is global to all threads in the process. A thread using the .Dv tss_t * pointer accesses private data.
p The .Fn tss_create function creates a thread-specific storage with the .Fa key handler with optional destructor .Fa dtor . If the .Fa dtor parameter is not .Dv NULL , then specified appropriate destructor will be called on thread termination. The destructor is not called if a thread called the .Fn tss_delete function for the specified .Fa key . If, after all the destructors have been called for all
f non- Dv NULL values with associated destructors, there are still some
f non- Dv NULL values with associated destructors, then the process is repeated. If, after at least .Dv TSS_DTOR_ITERATIONS iterations of destructor calls for outstanding
f non- Dv NULL values, there are still some
f non- Dv NULL values with associated destructors, the .Nx implementation stops calling further destructors. The .Xr thrd_exit 3 function must not be called from a destructor.
p The .Fn tss_delete function frees resources used by the thread-specific storage identified by the .Fa key object. This function can be called inside the .Fa dtor destructor, however the destructor is not called by .Fn tss_delete .
p The .Fn tss_get and .Fn tss_set functions are used to get and set thread-specific storage. .Sh RETURN VALUES The .Fn tss_create function returns .Dv thrd_success on success, otherwise .Dv thrd_error on failure.
p The .Fn tss_delete function returns no value.
p The .Fn tss_get returns pointer to thread-specific storage on success or .Dv NULL on failure.
p The .Fn tss_set function returns .Dv thrd_success on success, otherwise .Dv thrd_error on failure. .Sh SEE ALSO .Xr pthread_getspecific 3 , .Xr pthread_key_create 3 , .Xr threads 3 .Sh STANDARDS The .Nm interface conforms to .St -isoC-2011 . .Sh HISTORY This interface first appeared in .Nx 9 . .Sh AUTHORS .An Kamil Rytarowski Aq Mt kamil (at] NetBSD.org