Run TLS destructor after clearing TLS value, as per standard

This commit is contained in:
fincs 2019-08-04 21:03:04 +02:00
parent 6c194fc6a6
commit 21de119c68
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60

View File

@ -144,9 +144,10 @@ void threadExit(void) {
if (!(tls_mask & ((UINT64_C(1) << i))))
continue;
if (t->tls_array[i]) {
if (g_tlsDestructors[i])
g_tlsDestructors[i](t->tls_array[i]);
void* old_value = t->tls_array[i];
t->tls_array[i] = NULL;
if (g_tlsDestructors[i])
g_tlsDestructors[i](old_value);
}
}