-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix dispatch time comparisons #5078
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
/cc @mwwa |
e4be9ba
to
506816f
Compare
@@ -73,8 +72,12 @@ public struct DispatchWallTime : Comparable { | |||
} | |||
|
|||
public func <(a: DispatchWallTime, b: DispatchWallTime) -> Bool { | |||
if a.rawValue == ~0 || b.rawValue == ~0 { return false } | |||
return -Int64(a.rawValue) < -Int64(b.rawValue) | |||
if b.rawValue == ~0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by nit: indenting mismatch (this file uses \t).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh weird, I have a Vim plugin that's supposed to auto-detect this sort of thing but apparently it doesn't work anymore >_<
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR updated.
@mwwa should review this. The Linux overlay appears to have the same issue, can you please make a PR with the same change there ? |
@das I already submitted swiftlang/swift-corelibs-libdispatch#182 |
506816f
to
87bed5d
Compare
Is there anything blocking this from being reviewed? |
@swift-ci Please smoke test |
@kballard Thanks for bringing this up. I guess Matt just hasn't had time to review it yet. |
Yeah, I've been out of the country for two weeks. I'll try and get to this today/tomorrow. |
This looks good to me. @moiseev, can you merge? |
A PR with a cherrypick to the swift-3.0-branch may help push that forward. |
* [Dispatch] Don't crash when comparing DispatchWallTimes with < * [Dispatch] Make comparisons with distantFuture work as expected
Cherry-pick submitted as #5298. |
[swift-3.0-branch] Fix dispatch time comparisons (#5078)
This PR does two things:
<
comparisons onDispatchWallTime
not crash.<
comparisons againstDispatchTime.distantFuture
andDispatchWallTime.distantFuture
behave as expected.Fixes half of SR-2807.