Skip to content

Commit 02faea6

Browse files
committed
[FreeBSD]: Optional observation pthread primitives
The pthread APIs on FreeBSD do not include nullability APIs so the pthread mutex APIs are imported as pointers to optional values. Other platforms include nullability APIs and import the pthread APIs as pointers to the mutex. Splitting the locking primitive type based on the OS. Fixes: rdar://150880976
1 parent b311c63 commit 02faea6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/public/Observation/Sources/Observation/Locking.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ internal struct Lock {
3434
#if canImport(Darwin)
3535
typealias Primitive = os_unfair_lock
3636
#elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic)
37+
#if os(FreeBSD)
38+
typealias Primitive = pthread_mutex_t?
39+
#else
3740
typealias Primitive = pthread_mutex_t
41+
#endif
3842
#elseif canImport(WinSDK)
3943
typealias Primitive = SRWLOCK
4044
#elseif arch(wasm32)

0 commit comments

Comments
 (0)