Skip to content

Commit

Permalink
Merge pull request #2314 from Jehan/wip/Jehan/fix-openblas-crash
Browse files Browse the repository at this point in the history
Fix usage of TerminateThread() causing critical section corruption.
  • Loading branch information
martin-frbg committed Nov 20, 2019
2 parents 08fa83a + 1f60715 commit 3da6d66
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions driver/others/blas_server_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,15 @@ int BLASFUNC(blas_thread_shutdown)(void){

for(i = 0; i < blas_num_threads - 1; i++){
// Could also just use WaitForMultipleObjects
WaitForSingleObject(blas_threads[i], 5); //INFINITE);
DWORD wait_thread_value = WaitForSingleObject(blas_threads[i], 5000);

#ifndef OS_WINDOWSSTORE
// TerminateThread is only available with WINAPI_DESKTOP and WINAPI_SYSTEM not WINAPI_APP in UWP
TerminateThread(blas_threads[i],0);
// TerminateThread is only available with WINAPI_DESKTOP and WINAPI_SYSTEM not WINAPI_APP in UWP
if (WAIT_OBJECT_0 != wait_thread_value) {
TerminateThread(blas_threads[i],0);
}
#endif

CloseHandle(blas_threads[i]);
}

Expand Down

0 comments on commit 3da6d66

Please sign in to comment.