Skip to content

Commit 42a3cc9

Browse files
committed
Ensure this doesn't break the Windows build
- HANDLE was being picked up transitively by CF's reexporting; import it explicitly - There was one CF type in a stored property in a #if os(Windows) block.
1 parent dbee05d commit 42a3cc9

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

Sources/Foundation/FileHandle.swift

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ fileprivate let _write = Glibc.write(_:_:_:)
2424
fileprivate let _close = Glibc.close(_:)
2525
#endif
2626

27+
#if canImport(WinSDK)
28+
// We used to get the copy that was re-exported by CoreFoundation
29+
// but we want to explicitly depend on its types in this file,
30+
// so we need to make sure Swift doesn't think it's @_implementationOnly.
31+
import WinSDK
32+
#endif
33+
2734
extension NSError {
2835
internal var errnoIfAvailable: Int? {
2936
if domain == NSPOSIXErrorDomain {

Sources/Foundation/Process.swift

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
import Darwin
1414
#endif
1515

16+
#if canImport(WinSDK)
17+
// We used to get the copy that was re-exported by CoreFoundation
18+
// but we want to explicitly depend on its types in this file,
19+
// so we need to make sure Swift doesn't think it's @_implementationOnly.
20+
import WinSDK
21+
#endif
22+
1623
extension Process {
1724
public enum TerminationReason : Int {
1825
case exit

Sources/Foundation/Thread.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,17 @@ open class Thread : NSObject {
196196
private var _thread: _swift_CFThreadRef? = nil
197197

198198
#if os(Windows) && !CYGWIN
199-
internal var _attr: _CFThreadAttributes =
200-
_CFThreadAttributes(dwSizeOfAttributes: DWORD(MemoryLayout<_CFThreadAttributes>.size),
199+
private class NonexportedAttrStorage {
200+
var value = _CFThreadAttributes(dwSizeOfAttributes: DWORD(MemoryLayout<_CFThreadAttributes>.size),
201201
dwThreadStackReservation: 0)
202+
}
203+
204+
private let _attrStorage = NonexportedAttrStorage()
205+
206+
internal var _attr: _CFThreadAttributes {
207+
get { _attrStorage.value }
208+
set { _attrStorage.value = newValue }
209+
}
202210
#elseif CYGWIN
203211
internal var _attr : pthread_attr_t? = nil
204212
#else

0 commit comments

Comments
 (0)