From b131d2fb578dc103a1ea83ba71256350ef92d3fb Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sat, 8 Nov 2025 19:44:23 +0900 Subject: [PATCH] Add partial support for FreeBSD This change will allow `swift build` to succeed. However, SwiftPM support is still incomplete and does not yet allow adding `.freebsd` to `.when(platforms:)`, so `swift test` cannot be executed. --- Sources/AsyncAlgorithms/Locking.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/AsyncAlgorithms/Locking.swift b/Sources/AsyncAlgorithms/Locking.swift index a733ad87..16a6f263 100644 --- a/Sources/AsyncAlgorithms/Locking.swift +++ b/Sources/AsyncAlgorithms/Locking.swift @@ -29,7 +29,11 @@ internal struct Lock { #if canImport(Darwin) typealias Primitive = os_unfair_lock #elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic) || canImport(wasi_pthread) + #if os(FreeBSD) || os(OpenBSD) + typealias Primitive = pthread_mutex_t? + #else typealias Primitive = pthread_mutex_t + #endif #elseif canImport(WinSDK) typealias Primitive = SRWLOCK #else