aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/kmp.h
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2018-07-19 19:17:00 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2018-07-19 19:17:00 +0000
commitd7d72b740038e4285e1d51d6feb48330c0fb6f5a (patch)
tree3a942f79bbedae478b970910ba04346d52752f6a /runtime/src/kmp.h
parent7af70ccedd0517698ddf5f5e614b753b7b4ddce2 (diff)
Block library shutdown until unreaped threads finish spin-waiting
This change fixes possibly invalid access to the internal data structure during library shutdown. In a heavily oversubscribed situation, the library shutdown sequence can reach the point where resources are deallocated while there still exist threads in their final spinning loop. The added loop in __kmp_internal_end() checks if there are such busy-waiting threads and blocks the shutdown sequence if that is the case. Two versions of kmp_wait_template() are now used to minimize performance impact. Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D49452 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@337486 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime/src/kmp.h')
-rw-r--r--runtime/src/kmp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h
index 02236c5..497907b 100644
--- a/runtime/src/kmp.h
+++ b/runtime/src/kmp.h
@@ -2558,6 +2558,9 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
#if KMP_STATS_ENABLED
kmp_stats_list *th_stats;
#endif
+#if KMP_OS_UNIX
+ std::atomic<bool> th_blocking;
+#endif
} kmp_base_info_t;
typedef union KMP_ALIGN_CACHE kmp_info {