Skip to content
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

sync confusingly defines 3 types called Mutex #14530

Closed
huonw opened this issue May 30, 2014 · 6 comments
Closed

sync confusingly defines 3 types called Mutex #14530

huonw opened this issue May 30, 2014 · 6 comments

Comments

@huonw
Copy link
Member

huonw commented May 30, 2014

There's sync::Mutex<T>, sync::raw::Mutex and sync::mutex::Mutex. The latter two have similar signatures (no contained data) and similar but slightly different APIs. The docs don't describe the difference in detail.

This is pretty confusing (renaming and/or documenting better would be a good fix).

cc @alexcrichton

@huonw huonw added the A-libs label May 30, 2014
@alexcrichton
Copy link
Member

The mutex::Mutex implementation should eventually replace the sync::raw::Mutex primitive, it just needs cvar support. After that, we're only left with sync::Mutex and raw::Mutex. I'd be a little sad if raw::Mutex were renamed to something like raw::RawMutex because raw::Mutex already conveys that information, but I can see where this may be confusing when you're searching for mutexes in the sync docs.

@sfackler
Copy link
Member

@alexcrichton the current convention seems to be that types should be referenced without their module, so you'd actually want RawMutex. (I would also not be opposed to changing the convention, as prefixing everything is a huge pain)

@zkamsler
Copy link
Contributor

It might also be worth exploring renaming Mutex<T>, as it is occasionally a source of confusion that the mutex actually contains the data that it is protecting.

@huonw
Copy link
Member Author

huonw commented May 31, 2014

Oh, and there's the StaticMutex type too (although this clearly has its purpose in the name, so isn't particularly confusing).

@aturon
Copy link
Member

aturon commented Jun 3, 2014

cc me.

@aturon
Copy link
Member

aturon commented Jan 17, 2015

Addressed with sync overhaul.

@aturon aturon closed this as completed Jan 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants