diff --git a/openmp/runtime/src/kmp_taskdeps.h b/openmp/runtime/src/kmp_taskdeps.h --- a/openmp/runtime/src/kmp_taskdeps.h +++ b/openmp/runtime/src/kmp_taskdeps.h @@ -89,6 +89,16 @@ kmp_info_t *thread = __kmp_threads[gtid]; kmp_depnode_t *node = task->td_depnode; + // Check mutexinoutset dependencies, release locks + if (UNLIKELY(node && (node->dn.mtx_num_locks < 0))) { + // negative num_locks means all locks were acquired + node->dn.mtx_num_locks = -node->dn.mtx_num_locks; + for (int i = node->dn.mtx_num_locks - 1; i >= 0; --i) { + KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL); + __kmp_release_lock(node->dn.mtx_locks[i], gtid); + } + } + if (task->td_dephash) { KA_TRACE( 40, ("__kmp_release_deps: T#%d freeing dependencies hash of task %p.\n", diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp --- a/openmp/runtime/src/kmp_tasking.cpp +++ b/openmp/runtime/src/kmp_tasking.cpp @@ -849,17 +849,6 @@ } } - // Check mutexinoutset dependencies, release locks - kmp_depnode_t *node = taskdata->td_depnode; - if (node && (node->dn.mtx_num_locks < 0)) { - // negative num_locks means all locks were acquired - node->dn.mtx_num_locks = -node->dn.mtx_num_locks; - for (int i = node->dn.mtx_num_locks - 1; i >= 0; --i) { - KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL); - __kmp_release_lock(node->dn.mtx_locks[i], gtid); - } - } - // bookkeeping for resuming task: // GEH - note tasking_ser => task_serial KMP_DEBUG_ASSERT(