forked from OSchip/llvm-project
Add missing memory barrier for queuing locks
Otherwise I see hangs in the omp_single_copyprivate test when compiling in release mode. With the debug assertions, I get a failure `head > 0 && tail > 0`. Differential Revision: https://reviews.llvm.org/D40722 llvm-svn: 320150
This commit is contained in:
parent
dfa430f694
commit
86c307821c
|
@ -1456,6 +1456,7 @@ int __kmp_release_queuing_lock(kmp_queuing_lock_t *lck, kmp_int32 gtid) {
|
||||||
}
|
}
|
||||||
dequeued = FALSE;
|
dequeued = FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
KMP_MB();
|
||||||
tail = *tail_id_p;
|
tail = *tail_id_p;
|
||||||
if (head == tail) { /* only one thread on the queue */
|
if (head == tail) { /* only one thread on the queue */
|
||||||
#ifdef DEBUG_QUEUING_LOCKS
|
#ifdef DEBUG_QUEUING_LOCKS
|
||||||
|
|
|
@ -13,7 +13,7 @@ int test_omp_single_copyprivate()
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
nr_iterations = 0;
|
nr_iterations = 0;
|
||||||
#pragma omp parallel
|
#pragma omp parallel num_threads(4)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < LOOPCOUNT; i++)
|
for (i = 0; i < LOOPCOUNT; i++)
|
||||||
|
|
Loading…
Reference in New Issue