-
Couldn't load subscription status.
- Fork 125
Adopt Mutex.
#1351
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
Adopt Mutex.
#1351
Conversation
f31a9b9 to
6e41940
Compare
This PR adopts `Mutex` on all platforms except Darwin (where we still need to back-deploy further than `Mutex` is available.) Resolves #538.
6e41940 to
39e2c37
Compare
| lock.initialize(to: .init()) | ||
| } | ||
| #else | ||
| nonisolated(unsafe) let rawValue = rawValue |
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.
It's necessary for us to write nonisolated(unsafe) here and a few other places because T isn't universally Sendable. We have some types (pointers) that we need to guard with locks which are not sendable, and the compiler is concerned there may be data races. We know what we're doing (famous last words) but the compiler can't reason about it.
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.
Thanks!! This is a huge simplification
This reverts commit 13319e1.
Reverts #1351, this is failing to build in CI (https://ci.swift.org/job/oss-swift-pr-test-ubuntu-22_04/9662/)
This PR adopts `Mutex` on all platforms except Darwin (where we still need to back-deploy further than `Mutex` is available.) Resolves #538. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
This PR adopts `Mutex` on all platforms except Darwin (where we still need to back-deploy further than `Mutex` is available.) Blocked by swiftlang/swift#84771. Reapplies #1351. Resolves #538. Resolves rdar://131832797. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
This PR adopts
Mutexon all platforms except Darwin (where we still need to back-deploy further thanMutexis available.)Resolves #538.
Checklist: