From 9e9e7b38e0e656b77aeece4435ac09a068eb54e7 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 7 Jan 2019 19:19:34 +0000 Subject: Refactor test, no changes expected. llvm-svn: 350557 --- lldb/packages/Python/lldbsuite/test/macosx/queues/main.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/macosx') diff --git a/lldb/packages/Python/lldbsuite/test/macosx/queues/main.c b/lldb/packages/Python/lldbsuite/test/macosx/queues/main.c index 34b4607c662..3978b92bff1 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/queues/main.c +++ b/lldb/packages/Python/lldbsuite/test/macosx/queues/main.c @@ -4,7 +4,7 @@ #include #include -int finished_enqueueing_work = 0; +atomic_int finished_enqueueing_work = 0; atomic_int thread_count = 0; void @@ -54,7 +54,7 @@ submit_work_2(void *in) dispatch_async_f (*work_performer_2, NULL, doing_the_work_2); dispatch_async_f (*work_performer_2, NULL, doing_the_work_2); } - finished_enqueueing_work = 1; + atomic_fetch_add(&finished_enqueueing_work, 1); } @@ -144,11 +144,8 @@ int main (int argc, const char **argv) }); // Unfortunately there is no pthread_barrier on darwin. - while (atomic_load(&thread_count) < 13) - sleep(1); - - while (finished_enqueueing_work == 0) + while ((atomic_load(&thread_count) < 13) || (finished_enqueueing_work == 0)) sleep (1); - stopper (); + stopper (); } -- cgit v1.2.3