Skip to content

Commit bc00e13

Browse files
Merge pull request swiftlang#446 from compnerd/sometimes-code-is-ugly
Revert "Use numericCast() to get the correct type when creating a dis…
2 parents ff3bf51 + a9e4d44 commit bc00e13

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/swift/Block.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,23 @@ public class DispatchWorkItem {
4040
internal var _block: _DispatchBlock
4141

4242
public init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping @convention(block) () -> ()) {
43+
#if os(Windows) && (arch(arm64) || arch(x86_64))
44+
let flags = dispatch_block_flags_t(UInt32(flags.rawValue))
45+
#else
4346
let flags: dispatch_block_flags_t = numericCast(flags.rawValue)
47+
#endif
4448
_block = dispatch_block_create_with_qos_class(flags,
4549
qos.qosClass.rawValue.rawValue, Int32(qos.relativePriority), block)
4650
}
4751

4852
// Used by DispatchQueue.synchronously<T> to provide a path through
4953
// dispatch_block_t, as we know the lifetime of the block in question.
5054
internal init(flags: DispatchWorkItemFlags = [], noescapeBlock: () -> ()) {
55+
#if os(Windows) && (arch(arm64) || arch(x86_64))
56+
let flags = dispatch_block_flags_t(UInt32(flags.rawValue))
57+
#else
5158
let flags: dispatch_block_flags_t = numericCast(flags.rawValue)
59+
#endif
5260
_block = _swift_dispatch_block_create_noescape(flags, noescapeBlock)
5361
}
5462

0 commit comments

Comments
 (0)