diff options
| author | Chaoren Lin <chaorenl@google.com> | 2015-02-27 07:48:07 +0000 |
|---|---|---|
| committer | Chaoren Lin <chaorenl@google.com> | 2015-02-27 07:48:07 +0000 |
| commit | 3ef297aeda57c63fdc393a6e324ae7671c13127d (patch) | |
| tree | 636e4273540893c339b7cf98bae02d37ef314b09 | |
| parent | b1bc5cf4bcfa6861e83d87933cc8eeb759ac5253 (diff) | |
| download | bcm5719-llvm-3ef297aeda57c63fdc393a6e324ae7671c13127d.tar.gz bcm5719-llvm-3ef297aeda57c63fdc393a6e324ae7671c13127d.zip | |
Fixes http://reviews.llvm.org/rL230691
Summary: OS X doesn't implement pthread barriers, using a simple atomic flag instead.
Reviewers: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D7933
llvm-svn: 230739
| -rw-r--r-- | lldb/test/functionalities/watchpoint/hello_watchlocation/main.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lldb/test/functionalities/watchpoint/hello_watchlocation/main.cpp b/lldb/test/functionalities/watchpoint/hello_watchlocation/main.cpp index 007f4c3b06e..1b902f40609 100644 --- a/lldb/test/functionalities/watchpoint/hello_watchlocation/main.cpp +++ b/lldb/test/functionalities/watchpoint/hello_watchlocation/main.cpp @@ -13,12 +13,13 @@ #include <stdint.h> #include <stdlib.h> #include <unistd.h> +#include <atomic> pthread_t g_thread_1 = NULL; pthread_t g_thread_2 = NULL; pthread_t g_thread_3 = NULL; -pthread_barrier_t g_barrier; +std::atomic_bool g_ready(false); char *g_char_ptr = NULL; @@ -54,7 +55,7 @@ thread_func (void *arg) uint32_t thread_index = *((uint32_t *)arg); printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index); - pthread_barrier_wait(&g_barrier); + while (!g_ready); uint32_t count = 0; uint32_t val; @@ -88,22 +89,18 @@ int main (int argc, char const *argv[]) g_char_ptr = (char *)malloc (1); *g_char_ptr = 0; - pthread_barrier_init(&g_barrier, NULL, 4); - // Create 3 threads err = ::pthread_create (&g_thread_1, NULL, thread_func, &thread_index_1); err = ::pthread_create (&g_thread_2, NULL, thread_func, &thread_index_2); err = ::pthread_create (&g_thread_3, NULL, thread_func, &thread_index_3); printf ("Before turning all three threads loose...\n"); // Set break point at this line. - pthread_barrier_wait(&g_barrier); + g_ready = true; // Join all of our threads err = ::pthread_join (g_thread_1, &thread_result); err = ::pthread_join (g_thread_2, &thread_result); err = ::pthread_join (g_thread_3, &thread_result); - - pthread_barrier_destroy(&g_barrier); free(g_char_ptr); return 0; |

