Skip to content

Commit ad2c386

Browse files
authored
Move TLS key deletion to openblas_quit
fixes #1954 (as suggested by thrasibule in that issue)
1 parent 20d1aad commit ad2c386

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

driver/others/memory.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,11 +1073,6 @@ static volatile int memory_initialized = 0;
10731073
}
10741074
free(table);
10751075
}
1076-
#if defined(OS_WINDOWS)
1077-
TlsFree(local_storage_key);
1078-
#else
1079-
pthread_key_delete(local_storage_key);
1080-
#endif
10811076
}
10821077

10831078
static void blas_memory_init(){
@@ -1491,6 +1486,14 @@ void DESTRUCTOR gotoblas_quit(void) {
14911486

14921487
blas_shutdown();
14931488

1489+
#if defined(SMP)
1490+
#if defined(OS_WINDOWS)
1491+
TlsFree(local_storage_key);
1492+
#else
1493+
pthread_key_delete(local_storage_key);
1494+
#endif
1495+
#endif
1496+
14941497
#ifdef PROFILE
14951498
moncontrol (0);
14961499
#endif

0 commit comments

Comments
 (0)