Skip to content

[Concurrency] Don't pass negative times to the Dispatch code. #81332

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

Merged
merged 2 commits into from
May 7, 2025

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented May 6, 2025

Dispatch uses unsigned times, and cannot cope with times before its clock started. As such, passing negative times from Swift through to the C++ code results in large unsigned values, which then causes us to wait forever. This is undesirable.

rdar://148899609

Dispatch uses unsigned times, and cannot cope with times before its
clock started.  As such, passing negative times from Swift through to
the C++ code results in large unsigned values, which then causes us to
wait forever.  This is undesirable.

rdar://148899609
@al45tair al45tair requested a review from weissi May 6, 2025 14:58
@al45tair al45tair requested a review from ktoso as a code owner May 6, 2025 14:58
@al45tair
Copy link
Contributor Author

al45tair commented May 6, 2025

@swift-ci Please smoke test

@al45tair
Copy link
Contributor Author

al45tair commented May 6, 2025

I'm going to add a test for this as well.

…och.

Add a test to check that attempting to `Task.sleep(until:)` passing a
time before the start of the Dispatch clocks works and doesn't wait
forever.

rdar://148899609
@al45tair
Copy link
Contributor Author

al45tair commented May 6, 2025

@swift-ci Please smoke test

@al45tair al45tair merged commit 921d6d8 into swiftlang:main May 7, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants