-
Notifications
You must be signed in to change notification settings - Fork 472
POSIX: Keep original timeout from sleep call #878
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
The `dispatch_sema4_timedwait` would reset the `_timeout` to an absolute time after the sleep was interrupted instead of when the sleep was called. Interrupting the process while it was sleeping would result in the new absolute timeout deadline being computed using the `timeout` offset from the time of the interrupt. e.g. if the timeout is 10 seconds, it will be ten seconds from when the process was interrupted because the absolute deadline was recomputed. Interrupting the process repeatedly while sleeping would will make the process go back to sleep instead of waking up when the original absolute deadline was reached. `timeout` is a relative timeout offset. `nsec` and `_timeout` are absolute times since the epoch specifying when the wait should stop.
@swift-ci please test |
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.
LGTM.
|
@swift-ci please test Windows |
Windows failure: FileNotFoundError: [WinError 206] The filename or extension is too long
|
I think both of the other implementations call functions that take a wait duration, not a timestamp. |
Unfortunately, |
It is definitely a relative time (I checked). |
@swift-ci please test Windows platform |
@swift-ci Please test Windows platform |
@swift-ci please test Windows platform |
1 similar comment
@swift-ci please test Windows platform |
swiftlang/swift#82074 |
The
dispatch_sema4_timedwait
would reset the_timeout
to an absolute time after the sleep was interrupted instead of when the sleep was called. Interrupting the process while it was sleeping would result in the new absolute timeout deadline being computed using thetimeout
offset from the time of the interrupt. e.g. if the timeout is 10 seconds, it will be ten seconds from when the process was interrupted because the absolute deadline was recomputed. Interrupting the process repeatedly while sleeping would will make the process go back to sleep instead of waking up when the original absolute deadline was reached.timeout
is a relative timeout offset.nsec
and_timeout
are absolute times since the epoch specifying when the wait should stop.