1 #include "pthread_impl.h"
3 int pthread_setspecific(pthread_key_t k, const void *x)
5 struct pthread *self = pthread_self();
6 /* Handle the case of the main thread */
9 if (!(self->tsd = calloc(sizeof(void *), PTHREAD_KEYS_MAX)))
12 /* Avoid unnecessary COW */
13 if (self->tsd[k] != x) {
14 self->tsd[k] = (void *)x;