diff --git a/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift b/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift index c75fe9a00b..e56242b12b 100644 --- a/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift +++ b/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift @@ -73,7 +73,7 @@ extension NIOSingletons { let concurrencyEnqueueGlobalHookPtr = dlsym( dlopen(nil, RTLD_NOW), "swift_task_enqueueGlobal_hook" - )?.assumingMemoryBound(to: UnsafeRawPointer?.AtomicRepresentation.self) + )?.assumingMemoryBound(to: UnsafeRawPointer?.AtomicRep.self) guard let concurrencyEnqueueGlobalHookPtr = concurrencyEnqueueGlobalHookPtr else { return false } @@ -126,3 +126,12 @@ extension NIOSingletons { #endif } } + +// Workaround for https://github.com/apple/swift-nio/issues/2893 +extension Optional +where + Wrapped: AtomicOptionalWrappable, + Wrapped.AtomicRepresentation.Value == Wrapped +{ + typealias AtomicRep = Wrapped.AtomicOptionalRepresentation +}