Skip to content

Commit 9cf5a38

Browse files
committed
Fix build error on Linux
fix malcommac#66
1 parent 897e2d3 commit 9cf5a38

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/Hydra/Promise+Await.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ public extension Context {
9696
/// - Throws: throw if promise fails
9797
@discardableResult
9898
internal func await<T>(_ promise: Promise<T>) throws -> T {
99-
guard self.queue != DispatchQueue.main else {
99+
#if os(Linux)
100+
let isNotMainQueue = self.queue.label != DispatchQueue.main.label
101+
#else
102+
let isNotMainQueue = self.queue != DispatchQueue.main
103+
#endif
104+
guard isNotMainQueue else {
100105
// execute a promise on main context does not make sense
101106
// dispatch_semaphore_wait should NOT be called on the main thread.
102107
// more here: https://medium.com/@valentinkalchev/how-to-pause-and-resume-a-sequence-of-mutating-swift-structs-using-dispatch-semaphore-fc98eca55c0#.ipbujy4k2

0 commit comments

Comments
 (0)