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 22
22
#include " TaskPrivate.h"
23
23
#include " AsyncCall.h"
24
24
25
- #if defined(__APPLE__)
26
- // TODO: We shouldn't need this
27
- #include < dispatch/dispatch.h>
28
- #endif
29
-
30
25
using namespace swift ;
31
26
using FutureFragment = AsyncTask::FutureFragment;
32
27
@@ -509,23 +504,9 @@ struct AsyncContinuationContext {
509
504
510
505
static void resumeTaskAfterContinuation (AsyncTask *task,
511
506
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 );
526
508
}
527
509
528
-
529
510
}
530
511
531
512
SWIFT_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
412
412
@_alwaysEmitIntoClient
413
413
@usableFromInline
414
414
internal 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,
417
417
// if the receiver of the method invocation is itself an Actor, or in other
418
418
// situations.
419
- fatalError ( " not implemented " )
419
+ _ = Task . runDetached { await body ( ) }
420
420
}
421
421
422
422
#endif
You can’t perform that action at this time.
0 commit comments