Skip to content

Commit d606015

Browse files
authored
Merge pull request #35059 from jckarter/integrate-objc-interop-with-task-runtime
Integrate ObjC interop intrinsics with task runtime.
2 parents e8c7714 + 2ee6b70 commit d606015

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
@@ -412,11 +412,11 @@ public func _runChildTask<T>(operation: @escaping () async throws -> T) async
412412
@_alwaysEmitIntoClient
413413
@usableFromInline
414414
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,
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

0 commit comments

Comments
 (0)