diff --git a/openmp/runtime/src/kmp_lock.cpp b/openmp/runtime/src/kmp_lock.cpp --- a/openmp/runtime/src/kmp_lock.cpp +++ b/openmp/runtime/src/kmp_lock.cpp @@ -1239,6 +1239,9 @@ KMP_MB(); // ToDo: Use __kmp_wait_sleep or similar when blocktime != inf KMP_WAIT(spin_here_p, FALSE, KMP_EQ, lck); + // Synchronize writes to both runtime thread structures + // and writes in user code. + KMP_MB(); #ifdef DEBUG_QUEUING_LOCKS TRACE_LOCK(gtid + 1, "acq spin");