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