diff options
| author | Pavel Labath <labath@google.com> | 2016-05-10 07:54:25 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2016-05-10 07:54:25 +0000 |
| commit | ebc7135f8e529470c9745e8324d74f48f0fc3749 (patch) | |
| tree | cf18e8340883179ea63f0dbd0361bd058cbab5b9 /lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit | |
| parent | bdb54eb4573f554854531cfebde54f102b618d68 (diff) | |
| download | bcm5719-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/thread_exit')
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp index e498db7895d..c57db9f4852 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp @@ -12,21 +12,9 @@ #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. -#define do_nothing() - -#define pseudo_barrier_wait(bar) \ - --bar; \ - while (bar > 0) \ - do_nothing(); - -#define pseudo_barrier_init(bar, count) (bar = count) - -std::atomic_int g_barrier1; -std::atomic_int g_barrier2; -std::atomic_int g_barrier3; +pseudo_barrier_t g_barrier1; +pseudo_barrier_t g_barrier2; +pseudo_barrier_t g_barrier3; void * thread1 () |

