-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add full data-race safety and enable strict concurrency checking for Swift 6 compatibility #174
Conversation
9e410a3
to
67d831b
Compare
dc702ae
to
66fe52e
Compare
Looks good but the "Text Xcode 15" step seems to fail on watchOS. Can we do something about that? |
@winsmith I fixed the CI immediately after receiving the notification that CI failed. 😊 All passing now. |
@winsmith Please don't merge just yet, I just tested this branch in a real-world project and ran into this issue: Let me take another look, it seems marking I'll let you know when it's ready, marked as a draft PR for now. |
@winsmith I played around a lot to fix this issue, the only thing that worked were the changes I committed in 483b686. In my testing with iOS & macOS targets, it worked as expected. So I'm marking this PR as ready again. Note that extracting the computed properties into a property wrapper like this did NOT work (it still crashed): @propertyWrapper
struct ThreadSafe<Value> {
private let queue = DispatchQueue(label: "com.telemetrydeck.ThreadSafe", attributes: .concurrent)
private var value: Value
init(wrappedValue: Value) {
self.value = wrappedValue
}
var wrappedValue: Value {
get { return queue.sync { value } }
set { queue.async(flags: .barrier) { self.value = newValue } }
}
} I do not really understand why this doesn't work, it should be equivalent to what I committed, but apparently it's not. 🤷♂️ I also want to reiterate that it's probably a good idea if customers first try this out before we make an official release. For me, it worked, but maybe you wanna ask one or two customers if they wanna give it a try with the I could also ask on Mastodon for volunteers if you don't already know customers to contact. |
Fantastic work. I'll find a few customers to test this with! |
Let's merge this into main, but let's not add a release just yet. Then we can publish the blog post and we can hit up a few select customers. Would that work for you? |
@winsmith Yeah, sounds good. Let's go, I'm merging. 🎉 |
Implements #165.
Note that this is based off of the branch of #173 and therefore supersedes it. If this is merged first, #173 can be closed.
You might want to also check out my article in TelemetryDeck/docs#98 to understand the changes better.
Also, it's probably a good idea if a few real-world customers give these changes a spin, either by including the
feature/data-race-safety
branch or on themain
branch once this is merged. We should have some real-world testing before making a regular release.