[OpenMP][Tests] fix data race in an OpenMP runtime test

Reviewed by: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D81804
This commit is contained in:
Joachim Protze 2020-06-14 16:10:10 +02:00
parent ad1c46c3c0
commit 9e5aefc5f9

View File

@ -47,10 +47,14 @@ int main()
// all tasks, and detect the test failure if it has not been done yet.
if (failed < 0)
failed = throttling ? enqueued == NUM_TASKS : enqueued < NUM_TASKS;
#pragma omp atomic write
block = 0;
}
while (block)
;
int wait = 0;
do {
#pragma omp atomic read
wait = block;
} while (wait);
}
}
block = 0;