         var waiting = true
         failsWithErrorMessage("Waited more than 0.01 seconds") {
             waitUntil(timeout: 0.01) { done in
-                DispatchQueue.global().async {
+                let asyncOperation: () -> () = {
                     Thread.sleep(forTimeInterval: 0.1)
                     done()
                     waiting = false
+                }
+                if #available(OSX 10.10, *) {
+                    DispatchQueue.global().async(execute: asyncOperation)
+                } else {
+                    DispatchQueue.global(priority: .default).async(execute: asyncOperation)
                 }
             }
         }

    func testToEventuallyMustBeInMainThread() {
#if !SWIFT_PACKAGE
        var executedAsyncBlock: Bool = false
        DispatchQueue.global().async {
            expect {
                expect(1).toEventually(equal(2))
            }.to(raiseException(named: "InvalidNimbleAPIUsage"))
            executedAsyncBlock = true
        }
        expect(executedAsyncBlock).toEventually(beTruthy())
#endif
    }

    func testWaitUntilMustBeInMainThread() {
#if !SWIFT_PACKAGE
        var executedAsyncBlock: Bool = false
        let asyncOperation: () -> () = {
            expect {
                waitUntil { done in done() }
            }.to(raiseException(named: "InvalidNimbleAPIUsage"))
            executedAsyncBlock = true
        }
        if #available(OSX 10.10, *) {
            DispatchQueue.global().async(execute: asyncOperation)
        } else {
            DispatchQueue.global(priority: .default).async(execute: asyncOperation)
        }
        expect(executedAsyncBlock).toEventually(beTruthy())
#endif
    }
