Skip to content

Commit 82360c6

Browse files
committed
stdlib: remove pthread_barrier attributes
These were not in use, and removing this from the signature makes it possible to re-use the exact signature on Windows more easily.
1 parent 0693bec commit 82360c6

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public class _stdlib_Barrier {
126126
public init(threadCount: Int) {
127127
self._pthreadBarrier = _stdlib_pthread_barrier_t()
128128
let ret = _stdlib_pthread_barrier_init(
129-
_pthreadBarrierPtr, nil, CUnsignedInt(threadCount))
129+
_pthreadBarrierPtr, CUnsignedInt(threadCount))
130130
if ret != 0 {
131131
fatalError("_stdlib_pthread_barrier_init() failed")
132132
}

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

+2-17
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import Darwin
1515
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
1616
import Glibc
17+
#elseif os(Windows)
18+
import MSVCRT
1719
#endif
1820

1921
//
@@ -22,22 +24,6 @@ import Glibc
2224
// (OS X does not implement them.)
2325
//
2426

25-
public struct _stdlib_pthread_barrierattr_t {
26-
public init() {}
27-
}
28-
29-
public func _stdlib_pthread_barrierattr_init(
30-
_ attr: UnsafeMutablePointer<_stdlib_pthread_barrierattr_t>
31-
) -> CInt {
32-
return 0
33-
}
34-
35-
public func _stdlib_pthread_barrierattr_destroy(
36-
_ attr: UnsafeMutablePointer<_stdlib_pthread_barrierattr_t>
37-
) -> CInt {
38-
return 0
39-
}
40-
4127
public var _stdlib_PTHREAD_BARRIER_SERIAL_THREAD: CInt {
4228
return 1
4329
}
@@ -64,7 +50,6 @@ public struct _stdlib_pthread_barrier_t {
6450

6551
public func _stdlib_pthread_barrier_init(
6652
_ barrier: UnsafeMutablePointer<_stdlib_pthread_barrier_t>,
67-
_ attr: UnsafeMutablePointer<_stdlib_pthread_barrierattr_t>?,
6853
_ count: CUnsignedInt
6954
) -> CInt {
7055
barrier.pointee = _stdlib_pthread_barrier_t()

Diff for: validation-test/stdlib/StringSlicesConcurrentAppend.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func sliceConcurrentAppendThread(_ tid: ThreadID) {
9090
StringTestSuite.test("SliceConcurrentAppend") {
9191
barrierVar = UnsafeMutablePointer.allocate(capacity: 1)
9292
barrierVar!.initialize(to: _stdlib_pthread_barrier_t())
93-
var ret = _stdlib_pthread_barrier_init(barrierVar!, nil, 2)
93+
var ret = _stdlib_pthread_barrier_init(barrierVar!, 2)
9494
expectEqual(0, ret)
9595

9696
let (createRet1, tid1) = _stdlib_pthread_create_block(

0 commit comments

Comments
 (0)