Skip to content

Commit 6e74630

Browse files
committed
[Concurrency] Update Task and Group APIs based on Review 1
1 parent 717a132 commit 6e74630

40 files changed

+928
-543
lines changed

include/swift/ABI/Task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class ContinuationAsyncContext : public AsyncContext {
566566
/// task.
567567
///
568568
/// This type matches the ABI of a function `<T> () async throws -> T`, which
569-
/// is the type used by `Task.runDetached` and `Task.group.add` to create
569+
/// is the type used by `spawnDetached` and `Task.group.add` to create
570570
/// futures.
571571
class FutureAsyncContext : public AsyncContext {
572572
public:

stdlib/public/Concurrency/Task.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ void AsyncTask::completeFuture(AsyncContext *context) {
102102
reinterpret_cast<char *>(context) - sizeof(FutureAsyncContextPrefix));
103103
bool hadErrorResult = false;
104104
auto errorObject = asyncContextPrefix->errorResult;
105-
// printf("asyncTask::completeFuture errorObject: %p\n", errorObject);
106105
fragment->getError() = errorObject;
107106
if (errorObject) {
108107
hadErrorResult = true;

stdlib/public/Concurrency/Task.swift

Lines changed: 143 additions & 130 deletions
Large diffs are not rendered by default.

stdlib/public/Concurrency/TaskCancellation.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ extension Task {
2525
///
2626
/// - SeeAlso: `checkCancellation()`
2727
public static var isCancelled: Bool {
28-
Task.unsafeCurrent?.isCancelled ?? false
28+
withUnsafeCurrentTask { task in
29+
task?.isCancelled ?? false
30+
}
2931
}
3032

3133
/// Returns `true` if the task is cancelled, and should stop executing.

0 commit comments

Comments
 (0)