Add thread-locals for WIN32

This commit is contained in:
Nicolas Williams
2016-04-14 14:38:49 -05:00
parent fca9bc45e2
commit 2f0c45f784
7 changed files with 408 additions and 5 deletions

View File

@@ -533,8 +533,14 @@ static void
ar_tls_delete(void *ptr)
{
struct ar_tls *tls = ptr;
if (tls->head)
heim_release(tls->head);
heim_auto_release_t next = NULL;
if (tls == NULL)
return;
for (; tls->current != NULL; tls->current = next) {
next = tls->current->parent;
heim_release(tls->current);
}
free(tls);
}
@@ -593,8 +599,7 @@ autorel_dealloc(void *ptr)
if (tls->current != ptr)
heim_abort("autorelease not releaseing top pool");
if (tls->current != tls->head)
tls->current = ar->parent;
tls->current = ar->parent;
HEIMDAL_MUTEX_unlock(&tls->tls_mutex);
}