Skip to content

Commit 735b929

Browse files
committed
WIP/DNM: LLP64 support for SDK Overlay
If we cannot break the ABI for C++ users of libdispatch, this would allow us to build the SDK overlay for LLP64 targets.
1 parent f6376cb commit 735b929

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/swift/Block.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,24 @@ public class DispatchWorkItem {
4040
internal var _block: _DispatchBlock
4141

4242
public init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping @convention(block) () -> ()) {
43-
_block = dispatch_block_create_with_qos_class(dispatch_block_flags_t(UInt(flags.rawValue)),
43+
#if os(Windows) && arch(x86_64)
44+
let flags = dispatch_block_flags_t(UInt32(flags.rawValue))
45+
#else
46+
let flags = dispatch_block_flags_t(UInt(flags.rawValue))
47+
#endif
48+
_block = dispatch_block_create_with_qos_class(flags,
4449
qos.qosClass.rawValue.rawValue, Int32(qos.relativePriority), block)
4550
}
4651

4752
// Used by DispatchQueue.synchronously<T> to provide a path through
4853
// dispatch_block_t, as we know the lifetime of the block in question.
4954
internal init(flags: DispatchWorkItemFlags = [], noescapeBlock: () -> ()) {
50-
_block = _swift_dispatch_block_create_noescape(dispatch_block_flags_t(UInt(flags.rawValue)), noescapeBlock)
55+
#if os(Windows) && arch(x86_64)
56+
let flags = dispatch_block_flags_t(UInt32(flags.rawValue))
57+
#else
58+
let flags = dispatch_block_flags_t(UInt(flags.rawValue))
59+
#endif
60+
_block = _swift_dispatch_block_create_noescape(flags, noescapeBlock)
5161
}
5262

5363
public func perform() {

0 commit comments

Comments
 (0)