blob: 1ab4624bcfce31e845e43db73f86395d7551e8c0 [file] [log] [blame]
Blaine Garst86d0ba42010-08-04 23:34:21 +00001//
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.
6
7// CONFIG rdar://6405500
8
9#include <stdio.h>
10#include <stdlib.h>
11#import <dispatch/dispatch.h>
12#import <objc/objc-auto.h>
13
14int 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); });
22 };
23
24 dispatch_apply(10, dispatch_get_concurrent_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT), blockFu);
25
26 dispatch_main();
27 printf("shouldn't get here\n");
28 return 1;
29}