mirror of
https://github.com/intel/llvm.git
synced 2026-01-30 05:55:35 +08:00
[OpenMP] Add memory barrier to solve data race
Data race occurs when acquiring lock for critical section triggering assertion failure. Added barrier to ensure all memory is commited before checking assertion. Reviewed By: Hahnfeld Differential Revision: https://reviews.llvm.org/D76780
This commit is contained in:
@@ -1239,6 +1239,9 @@ __kmp_acquire_queuing_lock_timed_template(kmp_queuing_lock_t *lck,
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user