[Openmp-commits] [PATCH] D96750: [OpenMP] Remove shutdown attempt on Windows process detach

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Feb 15 21:54:22 PST 2021


jlpeyton created this revision.
jlpeyton added reviewers: AndreyChurbanov, tlwilmar, hbae, Nawrin.
jlpeyton added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
jlpeyton requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Only attempt shutdown if lpReserved is NULL. The Windows documentation states:

When handling DLL_PROCESS_DETACH, a DLL should free resources such as heap memory only if the DLL is being unloaded dynamically (the lpReserved parameter is NULL). If the process is terminating (the lpReserved parameter is non-NULL), all threads in the process except the current thread either have exited already or have been explicitly terminated by a call to the ExitProcess function, which might leave some process resources such as heaps in an inconsistent state. In this case, it is not safe for the DLL to clean up the resources. Instead, the DLL should allow the operating system to reclaim the memory.

Hence, don't bother with a "proper" shutdown and let the OS take care of resources when terminating the process vs. unloading DLL.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96750

Files:
  openmp/runtime/src/kmp_runtime.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96750.323885.patch
Type: text/x-patch
Size: 4848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210216/418d9ef3/attachment.bin>


More information about the Openmp-commits mailing list