mirror of
https://github.com/apple/swift-async-algorithms
synced 2026-11-22 04:10:40 +00:00
Add support for FreeBSD (#375)
* 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. * Make `swift test` work on FreeBSD
This commit is contained in:
1 parent
2de50036f6
commit
b8006a9de0
3 files changed
+8
No files matched your search
@@ -72,6 +72,7 @@ let package = Package(
|
||||
.macCatalyst,
|
||||
.android,
|
||||
.linux,
|
||||
.custom("freebsd"),
|
||||
.openbsd,
|
||||
.wasi,
|
||||
])
|
||||
@@ -87,6 +88,7 @@ let package = Package(
|
||||
.macCatalyst,
|
||||
.android,
|
||||
.linux,
|
||||
.custom("freebsd"),
|
||||
.openbsd,
|
||||
.wasi,
|
||||
])
|
||||
|
||||
@@ -34,7 +34,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(WASILibc)
|
||||
// This WASILibc variation is single threaded, provides no locks
|
||||
#elseif canImport(WinSDK)
|
||||
|
||||
@@ -55,6 +55,8 @@ final class TaskDriver: Sendable {
|
||||
let queue: WorkQueue
|
||||
#if canImport(Darwin) || canImport(wasi_pthread)
|
||||
nonisolated(unsafe) var thread: pthread_t?
|
||||
#elseif os(FreeBSD)
|
||||
nonisolated(unsafe) var thread = pthread_t(bitPattern: 0)
|
||||
#elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic)
|
||||
nonisolated(unsafe) var thread = pthread_t()
|
||||
#elseif canImport(WinSDK)
|
||||
|
||||
Reference in new issue
Block a user