29 lines · c
1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5 6// CONFIG rdar://64055007 8#include <stdio.h>9#include <stdlib.h>10#import <dispatch/dispatch.h>11#import <objc/objc-auto.h>12 13int main (int argc, const char * argv[]) {14 __block void (^blockFu)(size_t t);15 blockFu = ^(size_t t){16 if (t == 20) {17 printf("%s: success\n", argv[0]);18 exit(0);19 } else20 dispatch_async(dispatch_get_main_queue(), ^{ blockFu(20); });21 };22 23 dispatch_apply(10, dispatch_get_concurrent_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT), blockFu);24 25 dispatch_main();26 printf("shouldn't get here\n");27 return 1;28}29