1570af302Sopenharmony_ci#include "pthread_impl.h" 2570af302Sopenharmony_ci#include "pthread_ffrt.h" 3570af302Sopenharmony_ci 4570af302Sopenharmony_ciint pthread_setspecific(pthread_key_t k, const void *x) 5570af302Sopenharmony_ci{ 6570af302Sopenharmony_ci struct pthread *self = __pthread_self(); 7570af302Sopenharmony_ci /* Avoid unnecessary COW */ 8570af302Sopenharmony_ci if (self->tsd[k] != x) { 9570af302Sopenharmony_ci self->tsd[k] = (void *)x; 10570af302Sopenharmony_ci self->tsd_used = 1; 11570af302Sopenharmony_ci } 12570af302Sopenharmony_ci return 0; 13570af302Sopenharmony_ci} 14570af302Sopenharmony_ci 15570af302Sopenharmony_civoid pthread_settsd(void** tsd) 16570af302Sopenharmony_ci{ 17570af302Sopenharmony_ci struct pthread *self = __pthread_self(); 18570af302Sopenharmony_ci self->tsd = tsd; 19570af302Sopenharmony_ci}