Skip to content

waitQueue.compare_exchange_strong in the true loop can be weak #70636

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 1 commit into from
Jan 9, 2024

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Dec 27, 2023

weak is more suitable for this while loop than strong.

@AZero13 AZero13 requested review from ktoso and kavon as code owners December 27, 2023 15:53
@AZero13 AZero13 force-pushed the queue branch 2 times, most recently from 331ecfb to 301bca1 Compare December 28, 2023 16:56
weak is more suitable for this while loop than strong.
@glessard
Copy link
Contributor

glessard commented Jan 6, 2024

@swift-ci please test

@kavon
Copy link
Member

kavon commented Jan 8, 2024

I think this is still functionally correct and may yield better performance on certain platforms. When I initially changed these two compare-exhanges to strong in this PR, I was a bit overzealous.

If you could also simplify the one hasSuspended check then that would be great.

I'd like a review from @ktoso or someone else before merging.

@glessard
Copy link
Contributor

glessard commented Jan 9, 2024

@swift-ci please test windows platform

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is okey, and we cannot remove the hasSuspended bool.

Thanks!

@ktoso ktoso merged commit e2d2ca0 into swiftlang:main Jan 9, 2024
@ktoso ktoso added the concurrency runtime Feature: umbrella label for concurrency runtime features label Jan 9, 2024
@AZero13 AZero13 deleted the queue branch January 9, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency runtime Feature: umbrella label for concurrency runtime features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants