Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error on Linux #68

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Sources/Hydra/Promise+Await.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ public extension Context {
/// - Throws: throw if promise fails
@discardableResult
internal func await<T>(_ promise: Promise<T>) throws -> T {
guard self.queue != DispatchQueue.main else {
#if os(Linux)
let isNotMainQueue = self.queue.label != DispatchQueue.main.label
#else
let isNotMainQueue = self.queue != DispatchQueue.main
#endif
guard isNotMainQueue else {
// execute a promise on main context does not make sense
// dispatch_semaphore_wait should NOT be called on the main thread.
// more here: https://medium.com/@valentinkalchev/how-to-pause-and-resume-a-sequence-of-mutating-swift-structs-using-dispatch-semaphore-fc98eca55c0#.ipbujy4k2
Expand Down