At process exit DLL_PROCESS_DETACH is signaled to DllMain(), where then
a final cleanup is triggered. In stw_cleanup() code is triggered that
tries to communicate a shutdown to the spawned threads -- however at
that time those threads have already been terminated by the OS and so
the process hangs.
v2: skip stw_cleanup_thread() too
Signed-off-by: José Fonseca <jfonseca@vmware.com>
break;
case DLL_PROCESS_DETACH:
- stw_cleanup_thread();
- stw_cleanup();
+ if (lpReserved == NULL) {
+ stw_cleanup_thread();
+ stw_cleanup();
+ }
break;
}
return TRUE;