tsan: fix deadlock detector lit test output
[blocksruntime.git] / test / BlocksRuntime / rdar6405500.c
blob1ab4624bcfce31e845e43db73f86395d7551e8c0
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
7 // CONFIG rdar://6405500
9 #include <stdio.h>
10 #include <stdlib.h>
11 #import <dispatch/dispatch.h>
12 #import <objc/objc-auto.h>
14 int main (int argc, const char * argv[]) {
15 __block void (^blockFu)(size_t t);
16 blockFu = ^(size_t t){
17 if (t == 20) {
18 printf("%s: success\n", argv[0]);
19 exit(0);
20 } else
21 dispatch_async(dispatch_get_main_queue(), ^{ blockFu(20); });
24 dispatch_apply(10, dispatch_get_concurrent_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT), blockFu);
26 dispatch_main();
27 printf("shouldn't get here\n");
28 return 1;