Skip to content
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

Heap allocate our atomics #1429

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 5, 2024

We used C atomics but these were allocated as Swift variables. Even thought they were atomic, concurrent accesses to them could violate Swift’s exclusivity laws, raising thread sanitizer errors.

Allocate the C atomics using malloc to fix this problem.

rdar://129170128

@ahoppen
Copy link
Member Author

ahoppen commented Jun 5, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jun 6, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jun 6, 2024

@swift-ci Please test Windows

We used C atomics but these were allocated as Swift variables. Even thought they were atomic, concurrent accesses to them could violate Swift’s exclusivity laws, raising thread sanitizer errors.

Allocate the C atomics using malloc to fix this problem.

rdar://129170128
@ahoppen
Copy link
Member Author

ahoppen commented Jun 6, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jun 6, 2024

@swift-ci Please test Windows

@ahoppen ahoppen merged commit efd7f99 into swiftlang:main Jun 6, 2024
3 checks passed
@ahoppen ahoppen deleted the atomics_on_heap branch June 6, 2024 13:37
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