-
Notifications
You must be signed in to change notification settings - Fork 21
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
Client is not Send #14
Comments
Hi @Boddlnagg, when I implemented this lib for the first time, I was just onboarding that side of rust. I think that it would require a re-visit. I might look at how PortAudio handles this case and also read about thread safety for the CoreMIDI SDK. |
Hi @chris-zen, thanks for your reply, and I understand that you don't have a lot of spare time for this project. It's fine. I think the implementation would be trivial once it's clear whether marking I haven't been able to find documentation about this so far. I only found this, which claims that the CoreMIDI API is not thread-safe at all, and any call to a CoreMIDI API needs to be synchronized by the caller. But I can't really believe that (I would expect that separate It would be great to find someone who knows more about all this ... the public documentation doesn't really help much, unfortunately. It probably won't help much to look into other CoreMIDI wrappers (such as PortMidi), because the guarantee that |
Hi @Boddlnagg, after reading the CoreMIDI documentation from Apple, I found this sentence here that makes me think that we are safe to use
I interpret it as the clients just getting opaque handlers to objects created and managed in a central process (the CoreMIDI server), where every call from the client translates into IPC messages to it. My assumption is that it doesn't matter from what process or thread do the messages come from, as the server will take care of their ordering and dispatching. |
This sounds great! The specific errors that I get are this:
This means that You can easily test this by just defining a simple function and calling it: fn is_send<T: Send>() {}
is_send::<Client>();
is_send::<InputPort>(); However, after looking at the above errors again, I realize that the problem might not actually be the Core MIDI types, but the |
I see you are available now. I also have some time available now. Would you like we to pair and try to implement this together ? or else could you tell me what code are you compiling so I can reproduce those errors ? |
I'm not really available, but I can point you to the code: It's just asserting that |
Looking into this again, because I'm still bitten by it ... (Boddlnagg/midir#38 fails to build) unsafe impl<T> Send for BoxedCallback<T> {} in lib.rs (which is safe because there's a I would open a pull request if I had a macOS machine to try it ... |
@Boddlnagg please, could you review #15 ? |
@Boddlnagg |
Is it intentional that
coremidi::Client
is notSend
?I was not able to find any information regarding the thread safety of
MIDIClientRef
, but I also don't know about thread-safety in the macOS APIs in general ...I had users of midir complain that some structs are not
Send
, so I'm trying to implementSend
for everything, but of course I want to know whether it's actually safe ...The text was updated successfully, but these errors were encountered: