-
Notifications
You must be signed in to change notification settings - Fork 3k
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
mac/event: use mpv_event struct directly for event handling #15620
Conversation
Download the artifacts for this pull request: |
Why those changes are concurrency related? I don't mind not using pointer to event, but why it makes any difference here? |
because an UnsafeMutablePointer is mutable and not 'Sendable' (https://developer.apple.com/documentation/swift/sendable). a struct on the other hand can be (made) 'Sendable'. the event loop runs/will run on separate context and swift 6 strict concurrency will complain (error out) because of this. there are more changes needed, though don't want to lump all the changes together. otherwise it will be quite a big messy change. |
But we need to handle events synchronously, because the possible memory allocations inside of them are only valid until next event is received. So we shouldn't cross any context border, unless we do deep copy of events, but this would be tricky. |
the mpv_events are handled synchronously, the data inside of those mpv_events are copied over to the i am still trying to wrap my head around the pile of warnings/errors i get atm, so it is still quite possible that i am doing something wrong. my plan is to first do/fix/change the things that don't need a bump of the swift version and are somewhat unquestionable. |
This step needs to be done carefully. |
yeah definitely, i made sure the data that is currently used and copied over to the though on another note, i am probably going to change the swift event handling and this change is not needed anymore (probably), for the sake of the strict concurrency that is. though still testing. |
closing this. i have to fix the whole thing a bit differently than i anticipated. |
another preparation to make swift 6 concurrency changes a bit easier. also makes it a bit less verbose.