xref: /aosp_15_r20/external/musl/src/thread/pthread_setspecific.c (revision c9945492fdd68bbe62686c5b452b4dc1be3f8453)
1 #include "pthread_impl.h"
2 
pthread_setspecific(pthread_key_t k,const void * x)3 int pthread_setspecific(pthread_key_t k, const void *x)
4 {
5 	struct pthread *self = __pthread_self();
6 	/* Avoid unnecessary COW */
7 	if (self->tsd[k] != x) {
8 		self->tsd[k] = (void *)x;
9 		self->tsd_used = 1;
10 	}
11 	return 0;
12 }
13