From aed1d6c7db070320e0d8e332c29bddfabb26e414 Mon Sep 17 00:00:00 2001 From: Frizlab Date: Thu, 7 Mar 2024 22:40:13 +0100 Subject: [PATCH] Mark SafeGlobal as Sendable only if T is Sendable --- Sources/SafeGlobal/SafeGlobal.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SafeGlobal/SafeGlobal.swift b/Sources/SafeGlobal/SafeGlobal.swift index e4b7354..63ee3eb 100644 --- a/Sources/SafeGlobal/SafeGlobal.swift +++ b/Sources/SafeGlobal/SafeGlobal.swift @@ -3,8 +3,8 @@ import Foundation /* Inspiration from . */ -//@propertyWrapper -public final class SafeGlobal : @unchecked Sendable { +extension SafeGlobal : @unchecked Sendable where T : Sendable {} +public final class SafeGlobal { public var wrappedValue: T { get {safeGlobalLock.withLock{ _wrappedValue }}