pthread_setspecific.c 248 B

123456789101112
  1. #include "pthread_impl.h"
  2. int pthread_setspecific(pthread_key_t k, const void *x)
  3. {
  4. struct pthread *self = __pthread_self();
  5. /* Avoid unnecessary COW */
  6. if (self->tsd[k] != x) {
  7. self->tsd[k] = (void *)x;
  8. self->tsd_used = 1;
  9. }
  10. return 0;
  11. }