-
Notifications
You must be signed in to change notification settings - Fork 471
[Overlay/Queue]: Allow setting an optional value in setSpecific #172
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
Conversation
that is fairly reasonable but isn't this ABI breaking? @mwwa please review wrt this, I agree the patch makes sense and is useful. |
At this point I think this would need to be introduced as |
Urgh, it's disappointing that we're at that stage so early that we have to introduce new functions to patch flaws in existing ones. Alternatively, we could add a DispatchSpecific subscript on DidpatchQueue which allows setting nil (IIRC we can have generic subscripts, but I may be wrong) |
What I mean to say by that is: I wasn't aware binary compatibility was a concern for Swift 3. That's supposed to be the focus of Swift 4 stage 1, as I understand it. |
It's not a binary compatibility issue, it's a source compatibility problem if people have to change the signatures of their existing uses in order to be able to compile. |
@mwwa Is it actually source-breaking? Swift automatically promotes types to their optionals, so any code which used the non-optional setter will continue to compile. Also, this is technically a memory leak. I just encountered it in my app - thousands of DispatchSpecificKey allocations being left behind because something in Dispatch is retaining them (and can't be cleared). Each is 32 bytes so you lose 1K from just 32 of them. This is in a reasonably memory-constrained environment. |
@MadCoder can we make any progress on this? As I mentioned it shouldn't be source-breaking (although the symbol would change, so it is ABI-breaking) |
Good point with the source compat. That looks ok then. This needs to be cloned for the mainline Dispatch overlay too (in the apple/swift repo). @swift-ci please test. |
Failure is unrelated. It's the Foundation NSURLSession one that crops up from time to time. ' |
I think the Foundation test has been fixed now. Can we run it again? |
@swift-ci please test |
huh, ¯_(ツ)_/¯ Foundation contains a grand total of one (1) |
I don't know why the test is failing (some assertion failure in kqueue), but I'm sure this patch has nothing to do with it. |
Can we test this again? I'd like to try get it in for the 3.1 branch date |
Ping? This has already been merged in the Darwin SDK overlay. |
@swift-ci please test |
tests pass, so lets cleanup this discrepancy for 4.0 |
[Overlay/Queue]: Allow setting an optional value in setSpecific Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
Otherwise you can never clear anything you set