File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < Foundation/Foundation.h>
2
+
3
+ @interface Butt : NSObject
4
+
5
+ - (instancetype _Nonnull)init ;
6
+
7
+ - (void )butt : (NSInteger )x completionHandler : (void (^ _Nonnull)(NSInteger ))handler ;
8
+
9
+ @end
Original file line number Diff line number Diff line change
1
+ #include " objc_async.h"
2
+ #include < stdio.h>
3
+
4
+ @implementation Butt
5
+
6
+ - (instancetype )init {
7
+ return [super init ];
8
+ }
9
+
10
+ - (void )butt : (NSInteger )x completionHandler : (void (^)(NSInteger ))handler {
11
+ printf (" starting %ld \n " , (long )x);
12
+ handler (679 );
13
+ }
14
+
15
+ @end
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-clang %S/Inputs/objc_async.m -c -o %t/objc_async_objc.o
3
+ // RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %import-libdispatch -import-objc-header %S/Inputs/objc_async.h %s %t/objc_async_objc.o -o %t/objc_async
4
+ // RUN: %target-run %t/objc_async | %FileCheck %s
5
+
6
+ // REQUIRES: executable_test
7
+ // REQUIRES: concurrency
8
+ // REQUIRES: libdispatch
9
+ // REQUIRES: objc_interop
10
+
11
+ import _Concurrency
12
+
13
+ let task = Task . runDetached {
14
+ let butt = Butt ( )
15
+ let result = await butt. butt ( 1738 )
16
+ print ( " finishing \( result) " )
17
+ // FIXME: with a proper task runtime, we should exit naturally once all tasks
18
+ // complete
19
+ exit ( 0 )
20
+ }
21
+
22
+ // FIXME: use the real task runtime facilities
23
+ task. run ( )
24
+
25
+ dispatchMain ( )
26
+
27
+ // CHECK: starting 1738
28
+ // CHECK-NEXT: finishing 679
You can’t perform that action at this time.
0 commit comments