diff --git a/driver/others/blas_server_win32.c b/driver/others/blas_server_win32.c index bace54a23..e27725baf 100644 --- a/driver/others/blas_server_win32.c +++ b/driver/others/blas_server_win32.c @@ -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]); }