summaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-01-07 19:19:34 +0000
committerAdrian Prantl <aprantl@apple.com>2019-01-07 19:19:34 +0000
commiteaf99c71c636b37638279cf937c98366000b6f3f (patch)
tree443ef6e68d5907047fd888286e8e40ebf57fc213 /lldb
parentdb07547b16d860b19999681d04251660a7268431 (diff)
Refactor test, no changes expected.
Diffstat (limited to 'lldb')
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/queues/main.c11
1 files changed, 4 insertions, 7 deletions
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 <dispatch/dispatch.h>
#include <pthread.h>
-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 ();
}