forked from swiftlang/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
6da79ce
commit 85d6edb
Showing
1 changed file
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |