@@ -382,14 +382,21 @@ internal var _ignore = _UnsupportedPlatformError()
382
382
//===----------------------------------------------------------------------===//
383
383
384
384
#if !os(Windows)
385
+
386
+ #if os(OpenBSD)
387
+ public typealias Semaphore = UnsafeMutablePointer < sem_t ? >
388
+ #else
389
+ public typealias Semaphore = UnsafeMutablePointer < sem_t >
390
+ #endif
391
+
385
392
/// The value returned by `sem_open()` in the case of failure.
386
- public var SEM_FAILED : UnsafeMutablePointer < sem_t > ? {
393
+ public var SEM_FAILED : Semaphore ? {
387
394
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
388
395
// The value is ABI. Value verified to be correct for OS X, iOS, watchOS, tvOS.
389
- return UnsafeMutablePointer < sem_t > ( bitPattern: - 1 )
396
+ return Semaphore ( bitPattern: - 1 )
390
397
#elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
391
398
// The value is ABI. Value verified to be correct on Glibc.
392
- return UnsafeMutablePointer < sem_t > ( bitPattern: 0 )
399
+ return Semaphore ( bitPattern: 0 )
393
400
#else
394
401
_UnsupportedPlatformError ( )
395
402
#endif
@@ -398,7 +405,7 @@ public var SEM_FAILED: UnsafeMutablePointer<sem_t>? {
398
405
public func sem_open(
399
406
_ name: UnsafePointer < CChar > ,
400
407
_ oflag: Int32
401
- ) -> UnsafeMutablePointer < sem_t > ? {
408
+ ) -> Semaphore ? {
402
409
return _stdlib_sem_open2 ( name, oflag)
403
410
}
404
411
@@ -407,9 +414,10 @@ public func sem_open(
407
414
_ oflag: Int32 ,
408
415
_ mode: mode_t ,
409
416
_ value: CUnsignedInt
410
- ) -> UnsafeMutablePointer < sem_t > ? {
417
+ ) -> Semaphore ? {
411
418
return _stdlib_sem_open4 ( name, oflag, mode, value)
412
419
}
420
+
413
421
#endif
414
422
415
423
//===----------------------------------------------------------------------===//
0 commit comments