-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
When.BarrierQueue #26
Comments
Yeah, I think |
This queue used in Try run this test: override func spec() {
it("resolves the promise") {
let promises: [Promise<Int>] = (0..<100000).map { _ in
let promise = Promise<Int>(queue: DispatchQueue.global(), { resolve in
// +3 needed to avoid https://github.com/vadymmarkov/When/issues/27 issue
DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + 3) {
resolve(1)
}
})
return promise
}
let doneExpectation = self.expectation(description: "Done expectation")
when(promises)
.done({ result in
doneExpectation.fulfill()
})
self.waitForExpectations(timeout: 5.0, handler:nil)
}
} It fails. But if you change let barrierQueue = DispatchQueue(label: "When.BarrierQueue", attributes: DispatchQueue.Attributes.concurrent) to let barrierQueue = DispatchQueue(label: "When.BarrierQueue") test will success. |
@MontakOleg It makes sense I guess. How about if we change |
Yeah, if we add But if all calls to queue uses |
@MontakOleg Agree, good point 👍 Would you mind making a PR to change the queue to be not concurrent? |
Hello! I found what barrier queue is concurrent:
Functions.swift:
But it must be
serial
to behave as realbarrier
. Misprint?The text was updated successfully, but these errors were encountered: