[PATCH] D148728: [Support][Parallel] Add sequential mode to TaskGroup::spawn().

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 09:28:49 PDT 2023


MaskRay added inline comments.


================
Comment at: llvm/lib/Support/Parallel.cpp:133
+        Lock.unlock();
+        Task();
+        SequentialQueueIsLocked = false;
----------------
After `Lock.unclok()`, another thread may grab the lock and run a task concurrently.


================
Comment at: llvm/unittests/Support/ParallelTest.cpp:102
+
+    tg.spawn([&]() { Count++; }, true);
+
----------------
llvm style prefers pre-increments `++Count`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148728



More information about the llvm-commits mailing list