[Openmp-commits] [PATCH] D81804: [OpenMP][Tests] fix data race in a OpenMP runtime test

Joachim Protze via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 15 09:50:55 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9e5aefc5f93a: [OpenMP][Tests] fix data race in an OpenMP runtime test (authored by protze.joachim).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81804/new/

https://reviews.llvm.org/D81804

Files:
  openmp/runtime/test/tasking/omp_fill_taskqueue.c


Index: openmp/runtime/test/tasking/omp_fill_taskqueue.c
===================================================================
--- openmp/runtime/test/tasking/omp_fill_taskqueue.c
+++ openmp/runtime/test/tasking/omp_fill_taskqueue.c
@@ -47,10 +47,14 @@
           // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81804.270788.patch
Type: text/x-patch
Size: 679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200615/0aa9e546/attachment.bin>


More information about the Openmp-commits mailing list