Also call CloseHandle on each thread, as well as on the event so as to not leak thread handles.
This commit is contained in:
parent
4ad694eda1
commit
8ba9e2a61a
|
@ -461,13 +461,18 @@ int BLASFUNC(blas_thread_shutdown)(void){
|
||||||
SetEvent(pool.killed);
|
SetEvent(pool.killed);
|
||||||
|
|
||||||
for(i = 0; i < blas_num_threads - 1; i++){
|
for(i = 0; i < blas_num_threads - 1; i++){
|
||||||
|
// Could also just use WaitForMultipleObjects
|
||||||
WaitForSingleObject(blas_threads[i], 5); //INFINITE);
|
WaitForSingleObject(blas_threads[i], 5); //INFINITE);
|
||||||
#ifndef OS_WINDOWSSTORE
|
#ifndef OS_WINDOWSSTORE
|
||||||
// TerminateThread is only available with WINAPI_DESKTOP and WINAPI_SYSTEM not WINAPI_APP in UWP
|
// TerminateThread is only available with WINAPI_DESKTOP and WINAPI_SYSTEM not WINAPI_APP in UWP
|
||||||
TerminateThread(blas_threads[i],0);
|
TerminateThread(blas_threads[i],0);
|
||||||
#endif
|
#endif
|
||||||
|
CloseHandle(blas_threads[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CloseHandle(pool.filled);
|
||||||
|
CloseHandle(pool.killed);
|
||||||
|
|
||||||
blas_server_avail = 0;
|
blas_server_avail = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) {
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
#if defined(SMP) && defined(USE_TLS)
|
#if defined(SMP) && defined(USE_TLS)
|
||||||
blas_thread_memory_cleanup(void);
|
blas_thread_memory_cleanup();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue