summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/kmp_error.c
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2015-02-20 18:05:17 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2015-02-20 18:05:17 +0000
commit5c56fb55b0857181d7bb89c40cce9d87c0942c00 (patch)
tree3cf45a1a05d10be5375dd7bfccaa2a42623ae515 /openmp/runtime/src/kmp_error.c
parenta5547bce79d499dfca40695554a8d1a42648eae6 (diff)
downloadbcm5719-llvm-5c56fb55b0857181d7bb89c40cce9d87c0942c00.tar.gz
bcm5719-llvm-5c56fb55b0857181d7bb89c40cce9d87c0942c00.zip
Added new user-guided lock api, currently disabled. Use KMP_USE_DYNAMIC_LOCK=1 to enable it.
llvm-svn: 230030
Diffstat (limited to 'openmp/runtime/src/kmp_error.c')
-rw-r--r--openmp/runtime/src/kmp_error.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_error.c b/openmp/runtime/src/kmp_error.c
index 8bdf2f3ba9b..b76c1092f07 100644
--- a/openmp/runtime/src/kmp_error.c
+++ b/openmp/runtime/src/kmp_error.c
@@ -287,7 +287,11 @@ __kmp_push_workshare( int gtid, enum cons_type ct, ident_t const * ident )
}
void
+#if KMP_USE_DYNAMIC_LOCK
+__kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck, kmp_uint32 seq )
+#else
__kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck )
+#endif
{
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
@@ -345,7 +349,11 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
}
}
} else if ( ct == ct_critical ) {
+#if KMP_USE_DYNAMIC_LOCK
+ if ( lck != NULL && __kmp_get_user_lock_owner( lck, seq ) == gtid ) { /* this same thread already has lock for this critical section */
+#else
if ( lck != NULL && __kmp_get_user_lock_owner( lck ) == gtid ) { /* this same thread already has lock for this critical section */
+#endif
int index = p->s_top;
struct cons_data cons = { NULL, ct_critical, 0, NULL };
/* walk up construct stack and try to find critical with matching name */
@@ -380,14 +388,22 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
}
void
+#if KMP_USE_DYNAMIC_LOCK
+__kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck, kmp_uint32 seq )
+#else
__kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck )
+#endif
{
int tos;
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
KMP_ASSERT( gtid == __kmp_get_gtid() );
KE_TRACE( 10, ("__kmp_push_sync (gtid=%d)\n", gtid ) );
+#if KMP_USE_DYNAMIC_LOCK
+ __kmp_check_sync( gtid, ct, ident, lck, seq );
+#else
__kmp_check_sync( gtid, ct, ident, lck );
+#endif
KE_TRACE( 100, ( PUSH_MSG( ct, ident ) ) );
tos = ++ p->stack_top;
p->stack_data[ tos ].type = ct;
OpenPOWER on IntegriCloud