mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:44:46 +01:00
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user