Skip to content

Commit

Permalink
Address a few more warnings in the concurrency library
Browse files Browse the repository at this point in the history
  • Loading branch information
DougGregor committed Aug 26, 2021
1 parent 4a63884 commit 51e4fd2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions stdlib/public/Concurrency/AsyncStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ public struct AsyncStream<Element> {
let storage: _AsyncStreamCriticalStorage<Optional<() async -> Element?>>
= .create(produce)
self.produce = {
return await Task.withCancellationHandler {
storage.value = nil
onCancel?()
} operation: {
return await withTaskCancellationHandler {
guard let result = await storage.value?() else {
storage.value = nil
return nil
}
return result
} onCancel: {
storage.value = nil
onCancel?()
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions stdlib/public/Concurrency/TaskCancellation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public func withTaskCancellationHandler<T>(
operation: () async throws -> T,
onCancel handler: @Sendable () -> Void
) async rethrows -> T {
let task = Builtin.getCurrentAsyncTask()

// unconditionally add the cancellation record to the task.
// if the task was already cancelled, it will be executed right away.
let record = _taskAddCancellationHandler(handler: handler)
Expand Down
1 change: 1 addition & 0 deletions stdlib/public/Concurrency/TaskLocal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
// the type-checker that this property-wrapper never wants to have an enclosing
// instance (it is impossible to declare a property wrapper inside the `Never`
// type).
@available(*, unavailable, message: "property wrappers cannot be instance members")
public static subscript(
_enclosingInstance object: Never,
wrapped wrappedKeyPath: ReferenceWritableKeyPath<Never, Value>,
Expand Down

0 comments on commit 51e4fd2

Please sign in to comment.