Skip to content

Commit c992957

Browse files
authored
Merge pull request #81366 from etcwilde/ewilde/observe-freebsd-pthread-nullability
[FreeBSD]: Optional observation pthread primitives
2 parents ca0e984 + 1a546a9 commit c992957

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ 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) || os(OpenBSD)
38+
// BSD libc does not annotate the nullability of pthread APIs.
39+
// We should replace this with the appropriate API note in the platform
40+
// overlay.
41+
// https://github.com/swiftlang/swift/issues/81407
42+
typealias Primitive = pthread_mutex_t?
43+
#else
3744
typealias Primitive = pthread_mutex_t
45+
#endif
3846
#elseif canImport(WinSDK)
3947
typealias Primitive = SRWLOCK
4048
#elseif arch(wasm32)

0 commit comments

Comments
 (0)