Skip to content

Commit

Permalink
Add sending
Browse files Browse the repository at this point in the history
  • Loading branch information
guoye-zhang committed Oct 29, 2024
1 parent c82e407 commit 948fe6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/HTTPTypes/HTTPFields.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct HTTPFields: Sendable, Hashable {
required init() {
}

func withLock<Result>(_ body: () throws -> Result) rethrows -> Result {
func withLock<Result>(_ body: () throws -> sending Result) rethrows -> sending Result {
fatalError()
}

Expand Down Expand Up @@ -114,7 +114,7 @@ public struct HTTPFields: Sendable, Hashable {
private final class _StorageWithMutex: _Storage, @unchecked Sendable {
let mutex = Mutex<Void>(())

override func withLock<Result>(_ body: () throws -> Result) rethrows -> Result {
override func withLock<Result>(_ body: () throws -> sending Result) rethrows -> sending Result {
try self.mutex.withLock { _ in
try body()
}
Expand All @@ -125,7 +125,7 @@ public struct HTTPFields: Sendable, Hashable {
private final class _StorageWithNIOLock: _Storage, @unchecked Sendable {
let lock = LockStorage.create(value: ())

override func withLock<Result>(_ body: () throws -> Result) rethrows -> Result {
override func withLock<Result>(_ body: () throws -> sending Result) rethrows -> sending Result {
try self.lock.withLockedValue { _ in
try body()
}
Expand Down

0 comments on commit 948fe6c

Please sign in to comment.