Lines Matching refs:tsd
22 void crInitTSDF(CRtsd *tsd, void (*destructor)(void *))
25 tsd->key = TlsAlloc();
26 if (tsd->key == 0xffffffff) {
31 if (pthread_key_create(&tsd->key, destructor) != 0)
34 crDebug("crServer: TLS key %d allocated.", tsd->key);
36 tsd->initMagic = INIT_MAGIC;
40 void crInitTSD(CRtsd *tsd)
42 crInitTSDF(tsd, NULL);
46 void crFreeTSD(CRtsd *tsd)
50 if (TlsFree(tsd->key) == 0) {
54 if (pthread_key_delete(tsd->key) != 0)
55 crDebug("crServer: failed to delete TLS key %d.", tsd->key);
57 crDebug("crServer: TLS key %d deleted.", tsd->key);
59 tsd->initMagic = 0x0;
64 void crSetTSD(CRtsd *tsd, void *ptr)
66 if (tsd->initMagic != (int) INIT_MAGIC) {
68 crInitTSD(tsd);
71 if (TlsSetValue(tsd->key, ptr) == 0) {
75 if (pthread_setspecific(tsd->key, ptr) != 0) {
83 void *crGetTSD(CRtsd *tsd)
90 if (tsd->initMagic != (int) INIT_MAGIC) {
91 crInitTSD(tsd);
94 value = TlsGetValue(tsd->key);
113 return pthread_getspecific(tsd->key);