1 // RUN: %clang_tsan %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not='ThreadSanitizer'
4 #include "dispatch/dispatch.h"
11 fprintf(stderr
, "Hello world.\n");
12 dispatch_semaphore_t done
= dispatch_semaphore_create(0);
14 dispatch_queue_t q1
= dispatch_queue_create("my.queue1", DISPATCH_QUEUE_CONCURRENT
);
15 dispatch_queue_t q2
= dispatch_queue_create("my.queue2", DISPATCH_QUEUE_SERIAL
);
18 for (int i
= 0; i
< 10; i
++) {
20 for (int i
= 0; i
< 100; i
++) {
28 dispatch_barrier_async(q1
, ^{
29 dispatch_semaphore_signal(done
);
32 dispatch_semaphore_wait(done
, DISPATCH_TIME_FOREVER
);
33 fprintf(stderr
, "Done.\n");
36 // CHECK: Hello world.