static void qt_free_tls() { if (qt_tls != NULL) { DosFreeThreadLocalMemory((PULONG)qt_tls); qt_tls = NULL; } }
void vlc_threadvar_delete (vlc_threadvar_t *p_tls) { struct vlc_threadvar *var = *p_tls; vlc_mutex_lock (&super_mutex); if (var->prev != NULL) var->prev->next = var->next; else vlc_threadvar_last = var->next; if (var->next != NULL) var->next->prev = var->prev; vlc_mutex_unlock (&super_mutex); DosFreeThreadLocalMemory( var->id ); free (var); }
int main(VOID) { /* Allocate 3 DWORDs of local thread memory */ rc = DosAllocThreadLocalMemory(3, /* Number of DWORDs */ &pulThreadDWords); /* Address returned */ if (rc != NO_ERROR) { printf("DosAllocThreadLocalMemory error: return code = %u\n", rc); return 1; } /* ... Use the thread-local memory ... */ rc = DosFreeThreadLocalMemory(pulThreadDWords); /* Free the DWORDs */ if (rc != NO_ERROR) { printf("DosFreeThreadLocalMemory error: return code = %u\n", rc); return 1; } return NO_ERROR; }