[Lldb-commits] [lldb] r370963 - Revert "[test] Address TestConcurrentMany*.py flakiness on macOS"

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 4 12:36:29 PDT 2019


Author: jdevlieghere
Date: Wed Sep  4 12:36:29 2019
New Revision: 370963

URL: http://llvm.org/viewvc/llvm-project?rev=370963&view=rev
Log:
Revert "[test] Address TestConcurrentMany*.py flakiness on macOS"

This reverts my change to pseudo_barrier.h which isn't necessary anymore
after Fred's fix to debugserver and caused TestThreadStepOut to fail.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h?rev=370963&r1=370962&r2=370963&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h Wed Sep  4 12:36:29 2019
@@ -1,14 +1,21 @@
 #include <atomic>
-#include <thread>
+
+// Note that although hogging the CPU while waiting for a variable to change
+// would be terrible in production code, it's great for testing since it avoids
+// a lot of messy context switching to get multiple threads synchronized.
 
 typedef std::atomic<int> pseudo_barrier_t;
 
-static inline void pseudo_barrier_wait(pseudo_barrier_t &barrier) {
-  --barrier;
-  while (barrier > 0)
-    std::this_thread::yield();
-}
+#define pseudo_barrier_wait(barrier)        \
+    do                                      \
+    {                                       \
+        --(barrier);                        \
+        while ((barrier).load() > 0)        \
+            ;                               \
+    } while (0)
 
-static inline void pseudo_barrier_init(pseudo_barrier_t &barrier, int count) {
-  barrier = count;
-}
+#define pseudo_barrier_init(barrier, count) \
+    do                                      \
+    {                                       \
+        (barrier) = (count);                \
+    } while (0)




More information about the lldb-commits mailing list