Improve stability of the runtime in parent/child processes
This change improves stability of the runtime when the application forks child
processes. Acquiring/releasing __kmp_initz_lock and __kmp_forkjoin_lock in the
atfork handlers insures that the actual fork does not occur while those two
locks are held, and __kmp_itt_reset() reverts the itt's global state to the
initial state which also initializes the mutex stored in the global state.
Some missing initialization code was also inserted in the child's atfork handler.
Patch by Hansang Bae
Differential Revision: https://reviews.llvm.org/D41462
llvm-svn: 322202
diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index 03511ba..97baaf7 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -2727,7 +2727,7 @@
static kmp_task_team_t *__kmp_free_task_teams =
NULL; // Free list for task_team data structures
// Lock for task team data structures
-static kmp_bootstrap_lock_t __kmp_task_team_lock =
+kmp_bootstrap_lock_t __kmp_task_team_lock =
KMP_BOOTSTRAP_LOCK_INITIALIZER(__kmp_task_team_lock);
// __kmp_alloc_task_deque: