diff --git a/Sources/IssueReporting/Internal/LockIsolated.swift b/Sources/IssueReporting/Internal/LockIsolated.swift index 1a0ebfa..cd31da8 100644 --- a/Sources/IssueReporting/Internal/LockIsolated.swift +++ b/Sources/IssueReporting/Internal/LockIsolated.swift @@ -8,14 +8,27 @@ final class LockIsolated: @unchecked Sendable { init(_ value: sending Value) { self._value = value } - @usableFromInline - func withLock( - _ operation: sending (inout sending Value) throws -> sending T - ) rethrows -> sending T { - lock.lock() - defer { lock.unlock() } - var value = _value - defer { _value = value } - return try operation(&value) - } + #if compiler(>=6.3) + @usableFromInline + func withLock( + _ operation: sending (inout sending Value) throws -> sending T + ) rethrows -> sending T { + lock.lock() + defer { lock.unlock() } + var value = _value + defer { _value = value } + return try operation(&value) + } + #else + @usableFromInline + func withLock( + _ operation: @Sendable (inout Value) throws -> T + ) rethrows -> sending T { + lock.lock() + defer { lock.unlock() } + var value = _value + defer { _value = value } + return try operation(&value) + } + #endif }