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: Make Lock more similar to std::sync::Mutex #1573

Merged
merged 3 commits into from Sep 19, 2019
Merged

Conversation

jonhoo
Copy link
Sponsor Contributor

@jonhoo jonhoo commented Sep 19, 2019

This renames Lock to Mutex, and brings the API more in line with std::sync::Mutex. In partcular, locking now only takes &self, with the expectation that you place the Mutex in an Arc (or something similar) to share it between threads.

Fixes #1544.
Part of #1210.

Locking now only takes &self, with the expectation that you place the
Mutex in an Arc (or something similar) to share it between threads.

Fixes #1544.
Part of #1210.
@jonhoo jonhoo changed the title sync: Make Mutex more similar to std::sync::Mutex sync: Make Lock more similar to std::sync::Mutex Sep 19, 2019
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks!

@jonhoo
Copy link
Sponsor Contributor Author

jonhoo commented Sep 19, 2019

@carllerche you want me to squash and merge, or just merge?

@carllerche
Copy link
Member

Squash and merge here. PR is a single logical change.

@jonhoo jonhoo merged commit e3415d8 into master Sep 19, 2019
@jonhoo jonhoo deleted the jonhoo/async-lock branch September 19, 2019 15:47
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

Successfully merging this pull request may close these issues.

Lock::lock should take a &self instead of &mut self
2 participants