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

Allow unsafe creation of new lock guards #403

Merged
merged 6 commits into from Oct 17, 2023

Conversation

Lochlanna
Copy link
Contributor

This PR changes the visibility of the functions that produce the lock guards to public.
The inspiration for this comes from my desire to extend the mutex with new locking functions (async locking for example).

I was initially concerned that exposing this might be a bad idea even if it is useful. However, I decided that exposing these functions was no worse than the already public force_unlock functions.

@Amanieu
Copy link
Owner

Amanieu commented Oct 4, 2023

Could you rename these functions to make_guard_unchecked so that it's clear that these functions are unsafe and that you should carefully read the documentation for them?

Copy link
Owner

@Amanieu Amanieu left a comment

Choose a reason for hiding this comment

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

This is missing methods for other guard types such as upgradable guards and Arc guards.

lock_api/src/mutex.rs Show resolved Hide resolved
lock_api/src/rwlock.rs Outdated Show resolved Hide resolved
@Amanieu
Copy link
Owner

Amanieu commented Oct 17, 2023

Slight nit: could you rename the arc versions to make_arc(_read/write/upgradable)_guard?

After that it should be good to merge and I will publish a release to address #406

@Amanieu Amanieu merged commit 669bf52 into Amanieu:master Oct 17, 2023
37 checks passed
@Amanieu
Copy link
Owner

Amanieu commented Oct 17, 2023

Thanks!

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.

None yet

2 participants