-
Notifications
You must be signed in to change notification settings - Fork 168
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
Deprecate FutexOperation
instead of futex
#1118
Conversation
Regarding the naming conventions, see #753 (comment). I don't have a strong preference, but I do think we should be consistent. Are we going the module + name route? If so, the 1.0 list should rename stuff like inotify. |
The modules where we'd probably want to rename stuff are: procfs, mount, inotify, pipe, shm. |
Most functions in I could go either way on the |
My only thought for pipe was |
16529b2
to
f5023bf
Compare
4f66307
to
c0cbf53
Compare
With `rustix::thread::futex` being both a deprecated function and a public module, I'm seeing warnings like this when I use it in some simple testcases: ```console warning: use of deprecated function `rustix::thread::futex`: There are now individual functions available to perform futex operations with improved type safety. See the futex module. --> test.rs:2:21 | 2 | use rustix::thread::futex; | ^^^^^ | = note: `#[warn(deprecated)]` on by default ``` I think we can fix this by moving `futex` to be a top-level module, at `rustix::futex`. And this also reflects that, strictly speaking, futexes aren't specific to threads and can be used between processes too. Of course, this leaves the deprecated `rustix::thread::futex` and the associated types and constants in place. Also while using the API, I found `futex::FutexFlags` to be a little redundant, so I think it makes sense to rename it to `futex::Flags`, and similarly rename `futex::FUTEX_WAITERS` to `futex::WAITERS` and so on.
c0cbf53
to
5177d92
Compare
Additional datapoint: the epoll API already uses this style, with |
I have to say I did not expect the If you are happy with simply making it a top-level module (and thus add a feature for it), that would be a nice solution from the Futex perspective - however, I could also imagine that you would like to prevent the proliferation of top-level features, in which case a more local renaming might be more appropriate. |
This helps avoid adding more top-level module clutter, and futexes are related to threads; they even have builtin knowledge of TIDs.
This also fixes the semver incompatibility as the original `FutexOperation` is not `#[non_exhautive]`.
Thinking about this more, I am having more reservations about adding a whole new top-level module for this. And, I figured out that we can just deprecate |
As an aside, even though I observed above that futexes aren't specific to threads, thinking about it more, they kind of are, just not necessarily threads in the same process. They even have knowledge of TIDs built in. So they are pretty thread-oriented. |
futex
to be a top-level module.FutexOperation
instead of futex
This is released in rustix 0.38.35. |
With
rustix::thread::futex
being both a deprecated function and a public module, I'm seeing warnings like this when I use it in some simple testcases:I think we can fix this by moving
futex
to be a top-level module, atrustix::futex
. And this also reflects that, strictly speaking, futexes aren't specific to threads and can be used between processes too.Of course, this leaves the deprecated
rustix::thread::futex
and the associated types and constants in place.Also while trying out the API, I found that now that we have a public
futex
module, using it asfutex::wait
etc. makes me want to write things likefutex::FutexFlags
, which feels redundant. I propose we rename it tofutex::Flags
, and similarly renamefutex::FUTEX_WAITERS
tofutex::WAITERS
and so on.@danielschemmel How does this look to you?