File tree Expand file tree Collapse file tree 2 files changed +4
-23
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +4
-23
lines changed Original file line number Diff line number Diff line change 2222#include " TaskPrivate.h"
2323#include " AsyncCall.h"
2424
25- #if defined(__APPLE__)
26- // TODO: We shouldn't need this
27- #include < dispatch/dispatch.h>
28- #endif
29-
3025using namespace swift ;
3126using FutureFragment = AsyncTask::FutureFragment;
3227
@@ -509,23 +504,9 @@ struct AsyncContinuationContext {
509504
510505static void resumeTaskAfterContinuation (AsyncTask *task,
511506 AsyncContinuationContext *context) {
512- #if __APPLE__
513- // TODO: Enqueue the task on the specific executor in the continuation
514- // context.
515- //
516- // For now, just enqueue the task resumption on the global concurrent queue
517- // so that we're able to return back to the caller of resume.
518-
519- dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ),
520- ^{
521- task->run (context->ResumeExecutor );
522- });
523- #else
524- swift_unreachable (" not implemented" );
525- #endif
507+ swift_task_enqueue (task, context->ResumeExecutor );
526508}
527509
528-
529510}
530511
531512SWIFT_CC (swift)
Original file line number Diff line number Diff line change @@ -412,11 +412,11 @@ public func _runChildTask<T>(operation: @escaping () async throws -> T) async
412412@_alwaysEmitIntoClient
413413@usableFromInline
414414internal func _runTaskForBridgedAsyncMethod( _ body: @escaping ( ) async -> Void ) {
415- // TODO: As a start, we should invoke Task.runDetached here, but we
416- // can probably do better if we're already running on behalf of a task,
415+ // TODO: We can probably do better than Task.runDetached
416+ // if we're already running on behalf of a task,
417417 // if the receiver of the method invocation is itself an Actor, or in other
418418 // situations.
419- fatalError ( " not implemented " )
419+ _ = Task . runDetached { await body ( ) }
420420}
421421
422422#endif
You can’t perform that action at this time.
0 commit comments