[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
1 changed files with 6 additions and 2 deletions

View File

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