Skip to content

Commit 2ee6b70

Browse files
committed
Integrate ObjC interop intrinsics with task runtime.
1 parent f4e74f7 commit 2ee6b70

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
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-
3025
using namespace swift;
3126
using FutureFragment = AsyncTask::FutureFragment;
3227

@@ -509,23 +504,9 @@ struct AsyncContinuationContext {
509504

510505
static 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

531512
SWIFT_CC(swift)

stdlib/public/Concurrency/Task.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,11 @@ public func _runChildTask<T>(operation: @escaping () async throws -> T) async
438438
@_alwaysEmitIntoClient
439439
@usableFromInline
440440
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,
443443
// if the receiver of the method invocation is itself an Actor, or in other
444444
// situations.
445-
fatalError("not implemented")
445+
_ = Task.runDetached { await body() }
446446
}
447447

448448
#endif

0 commit comments

Comments
 (0)