Skip to content

Commit c6ba966

Browse files
authored
Add ifdef to ThreadBarriers to fix master builds (#107)
1 parent 5529fd7 commit c6ba966

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: stdlib/private/SwiftPrivateThreadExtras/ThreadBarriers.swift

+13
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ public func _stdlib_thread_barrier_init(
8787
return 0
8888
}
8989

90+
#if !os(Windows) && !os(WASI)
91+
private func _stdlib_thread_barrier_mutex_and_cond_init(_ barrier: UnsafeMutablePointer<_stdlib_thread_barrier_t>) -> CInt {
92+
guard pthread_mutex_init(barrier.pointee.mutex!, nil) == 0 else {
93+
return -1
94+
}
95+
guard pthread_cond_init(barrier.pointee.cond!, nil) == 0 else {
96+
pthread_mutex_destroy(barrier.pointee.mutex!)
97+
return -1
98+
}
99+
return 0
100+
}
101+
#endif
102+
90103
public func _stdlib_thread_barrier_destroy(
91104
_ barrier: UnsafeMutablePointer<_stdlib_thread_barrier_t>
92105
) -> CInt {

0 commit comments

Comments
 (0)