Skip to content

Commit 23142ce

Browse files
JDevlieghereadrian-prantl
authored andcommitted
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. llvm-svn: 370963 (cherry picked from commit 85d6edb)
1 parent a5ffceb commit 23142ce

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
#include <atomic>
2-
#include <thread>
2+
3+
// Note that although hogging the CPU while waiting for a variable to change
4+
// would be terrible in production code, it's great for testing since it avoids
5+
// a lot of messy context switching to get multiple threads synchronized.
36

47
typedef std::atomic<int> pseudo_barrier_t;
58

6-
static inline void pseudo_barrier_wait(pseudo_barrier_t &barrier) {
7-
--barrier;
8-
while (barrier > 0)
9-
std::this_thread::yield();
10-
}
9+
#define pseudo_barrier_wait(barrier) \
10+
do \
11+
{ \
12+
--(barrier); \
13+
while ((barrier).load() > 0) \
14+
; \
15+
} while (0)
1116

12-
static inline void pseudo_barrier_init(pseudo_barrier_t &barrier, int count) {
13-
barrier = count;
14-
}
17+
#define pseudo_barrier_init(barrier, count) \
18+
do \
19+
{ \
20+
(barrier) = (count); \
21+
} while (0)

0 commit comments

Comments
 (0)