Merge pull request #3111 from hawkinsp/forkrace

Fix race in blas_thread_shutdown.
This commit is contained in:
Martin Kroeker 2021-02-19 09:57:18 +01:00 committed by GitHub
commit 1caa44bea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 18 deletions

View File

@ -1024,10 +1024,10 @@ int BLASFUNC(blas_thread_shutdown)(void){
int i; int i;
if (!blas_server_avail) return 0;
LOCK_COMMAND(&server_lock); LOCK_COMMAND(&server_lock);
if (blas_server_avail) {
for (i = 0; i < blas_num_threads - 1; i++) { for (i = 0; i < blas_num_threads - 1; i++) {
@ -1051,11 +1051,12 @@ int BLASFUNC(blas_thread_shutdown)(void){
} }
#ifdef NEED_STACKATTR #ifdef NEED_STACKATTR
pthread_attr_destory(&attr); pthread_attr_destroy(&attr);
#endif #endif
blas_server_avail = 0; blas_server_avail = 0;
}
UNLOCK_COMMAND(&server_lock); UNLOCK_COMMAND(&server_lock);
return 0; return 0;