Multithreaded Programming Guide

Create a Thread-Specific Data Key

Except for the function names and arguments, thread specific data is the same for Solaris as it is for POSIX. The synopses for the Solaris functions are given in this section.


thr_keycreate(3T) allocates a key that is used to identify thread-specific data in a process. (For POSIX threads, see "pthread_key_create(3T)".)

#include <thread.h>

int thr_keycreate(thread_key_t *keyp,
    void (*destructor) (void *value));