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/step_out | |
| 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/step_out')
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp index b4c6216d6bf..31f9a1576b9 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp @@ -13,19 +13,7 @@ #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_barrier; +pseudo_barrier_t g_barrier; volatile int g_test = 0; |

