summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-05-10 07:54:25 +0000
committerPavel Labath <labath@google.com>2016-05-10 07:54:25 +0000
commitebc7135f8e529470c9745e8324d74f48f0fc3749 (patch)
treecf18e8340883179ea63f0dbd0361bd058cbab5b9 /lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events
parentbdb54eb4573f554854531cfebde54f102b618d68 (diff)
downloadbcm5719-llvm-ebc7135f8e529470c9745e8324d74f48f0fc3749.tar.gz
bcm5719-llvm-ebc7135f8e529470c9745e8324d74f48f0fc3749.zip
Fix race in TestExitDuringStep and unify pseudo_barrier handling
Summary: TestExitDuringStep was very rarely hanging on the buildbots. I can't be sure, but I believe this was because of the fact that it declared its pseudo_barrier variable as "volatile int", which is not sufficient to guarantee corectness (also, all other tests used atomic variables for this, and they were passing reliably AFAIK). Besides switching to an atomic variable in this test as well, I have also took this opportunity to unify all the copies of the pseudo_barrier code to a single place to reduce the chance of this happening again. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D20065 llvm-svn: 269025
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp
index ac2535cd2bf..10b55bff3ba 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp
@@ -23,22 +23,10 @@ using namespace std;
#include <sys/types.h>
#include <unistd.h>
-// 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.
-#define do_nothing()
-
-#define pseudo_barrier_wait(bar) \
- --bar; \
- while (bar > 0) \
- do_nothing();
-
-#define pseudo_barrier_init(bar, count) (bar = count)
-
typedef std::vector<std::pair<unsigned, void*(*)(void*)> > action_counts;
typedef std::vector<pthread_t> thread_vector;
-std::atomic_int g_barrier;
+pseudo_barrier_t g_barrier;
int g_breakpoint = 0;
int g_sigusr1_count = 0;
std::atomic_int g_watchme;
OpenPOWER on IntegriCloud