void _glthread_InitTSD(_glthread_TSD *tsd) { tsd->key = TlsAlloc(); if (tsd->key == TLS_OUT_OF_INDEXES) { perror("Mesa:_glthread_InitTSD"); InsteadOf_exit(-1); } tsd->initMagic = INIT_MAGIC; }
void u_tsd_init(struct u_tsd *tsd) { tsd->key = TlsAlloc(); if (tsd->key == TLS_OUT_OF_INDEXES) { perror(INIT_TSD_ERROR); InsteadOf_exit(-1); } tsd->initMagic = INIT_MAGIC; }
void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { /* the following code assumes that the _glthread_TSD has been initialized to zero at creation */ if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } if (TlsSetValue(tsd->key, ptr) == 0) { perror("Mesa:_glthread_SetTSD"); InsteadOf_exit(-1); } }
void u_tsd_set(struct u_tsd *tsd, void *ptr) { /* the following code assumes that the struct u_tsd has been initialized to zero at creation */ if (tsd->initMagic != INIT_MAGIC) { u_tsd_init(tsd); } if (TlsSetValue(tsd->key, ptr) == 0) { perror(SET_TSD_ERROR); InsteadOf_exit(-1); } }