-
Notifications
You must be signed in to change notification settings - Fork 666
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
impl Send for KEvent #442
impl Send for KEvent #442
Conversation
Both test failures were due to setup issues with rust 1.2.0, and were not related to my change. |
@asomers Can you rebase on master? The CI issue should be fixed. |
Actually, I think the build kicked off by homu should pass as it will create the merge commit and test that. Change looks good to me. Since KEvent has already changed with this release, I don't think additional release notes are required. @homu r+ |
📌 Commit f9b178b has been approved by |
How is |
impl Send for KEvent carllerche/mio needs KEvent to be Send-able. It's safe to send because udata is always treated as a uintptr_t. The only ways to use udata that wouldn't be Send-able would also be unsafe because they would require casting udata to a pointer. So I think it's safe to add the Send trait to KEvent.
@fiveop |
@homu r- for now |
☀️ Test successful - status |
@homu r- |
@posborne what would you to be satisfied with this PR? I admit that I'm a Rust novice, but I'm pretty sure that uintptr_t is safe to send, since it's just an integer. If any user tries to store a pointer in udata, they'll still need an unsafe{} block when converting udata back into a pointer. |
Hi @asomers I held off on the merge as there was more discussion that seems like it needed to take place and haven't gotten around to thinking about this one more for a few days (was hanging out with @kamalmarhubi and others at the Rust Belt Rust conference). Looking at things again, I'm not sure the basis for your argument that Perhaps some more context on what you are trying to accomplish in mio could be useful. Is there a tracking issue for what you are trying to accomplish? |
@posborne I don't understand your comment. You seem to be saying that all Structs with multiple elements are by default not Sendable, but they are. For example, the following code works:
My problem is in carllerche/mio in test/test_notify.rs. The
|
Ok, I see now. Pardon my ignorance, it's been a little while since I have had to grapple with Ok, I approve of the change and we can merge. Could you quickly add a line to the changelog saying that we know mark Thanks for explanation and the change! |
Thanks, to deal with the conflict, I went ahead and rebased your branch on upstream master. #453 should be merged shortly with your changes. Thanks! |
carllerche/mio needs KEvent to be Send-able. It's safe to send because udata is always treated as a uintptr_t. The only ways to use udata that wouldn't be Send-able would also be unsafe because they would require casting udata to a pointer. So I think it's safe to add the Send trait to KEvent.