-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SR-8572: Rework OperationQueue.isSuspended to stop suspending underly… #1665
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
SR-8572: Rework OperationQueue.isSuspended to stop suspending underly… #1665
Conversation
…ing DispatchQueue - Suspending the underlying DispatchQueue causes issues when an app needs to use the same DispatchQueue for scheduling work from multiple OperationQueue's and control which OperationQueue's are suspended or not
@phausler , @dgrove-oss , @parkera , please kindly review. Thanks! |
@swift-ci please test |
I'll see if we can get some eyes on this. |
Unfortunately this really isnt the way NSOQ works, the current implementation is somewhat close but has some key omissions. there are going to be edge cases for scheduling work here that won't be caught up in the changes listed but it would take probably a much larger effort to get that done than a smaller fix like this. If I had spare cycles to push it closer to the Darwin implementation this wouldn't really be needed. For now I guess this is an ok bandaid? |
I'm a little confused... Doing some additional testing yesterday, I discovered that the new test case I added running outside the test environment appears to hang. I created a file, queue4.swift with the following content: var done1 = false let dispatchQueue = DispatchQueue(label: "underlying_queue") operationQueue.addOperation { dispatchQueue.async { let timeout:TimeInterval = 4
} while Date().compare(timeoutDate) == ComparisonResult.orderedAscending I compile with with swiftc from 4.2-CONVERGENCE bundle. Then execute it like this: And "here" is never printed. I'm not sure why. This works completely fine in the XCTestCase environment. Any idea what could be wrong? Thanks! |
Nevermind my previous post. I built the full toolchain using swift/utils/build-toolchain from this PR and now everything is fine. I thought it's ok to mix swift-4.2-CONVERGENCE swift compiler with libFoundation I built in debug mode, but that turns out to cause issues. When everything is built together as a single toolchain, everything works fine. Can we get this merged in please? Thanks! |
Thank you @maksimorlovich ! |
Thank you @parkera . What is the general process of merging code into master? Will it be done automatically after 4.2 branch is finalized and released? Or are developers themselves responsible for doing the merges? Thanks! |
@maksimorlovich Just create another PR against |
Yes, I missed that this was on the 4.2 branch. I'm going to revert it, actually. Let's do it on master first. Sorry about the process confusion. |
@parkera So that's the process. Master first, then 4.2? (Or whatever the next release branch is, since 4.2 is pretty much done) Thanks! |
No worries, I should have noticed the branch. |
…ing DispatchQueue
use the same DispatchQueue for scheduling work from multiple OperationQueue's
and control which OperationQueue's are suspended or not