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 @@ -438,11 +438,11 @@ public func _runChildTask<T>(operation: @escaping () async throws -> T) async
438
438
@_alwaysEmitIntoClient
439
439
@usableFromInline
440
440
internal func _runTaskForBridgedAsyncMethod( _ body: @escaping ( ) async -> Void ) {
441
- // TODO: As a start, we should invoke Task.runDetached here, but we
442
- // can probably do better if we're already running on behalf of a task,
441
+ // TODO: We can probably do better than Task.runDetached
442
+ // if we're already running on behalf of a task,
443
443
// if the receiver of the method invocation is itself an Actor, or in other
444
444
// situations.
445
- fatalError ( " not implemented " )
445
+ _ = Task . runDetached { await body ( ) }
446
446
}
447
447
448
448
#endif
You can’t perform that action at this time.
0 commit comments