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

usage of parking_lot #1

Open
hffmnn opened this issue Nov 25, 2021 · 0 comments
Open

usage of parking_lot #1

hffmnn opened this issue Nov 25, 2021 · 0 comments

Comments

@hffmnn
Copy link

hffmnn commented Nov 25, 2021

Hi there and thanks for the book.

I really like the pragmatic approach which is a perfect fit for the way I like to work!

In the book, you write that one has to be cautious that the std::sync::RwLock is sync and we need to choose an async version. Reading the docs of parking_lot I can't find any info, that it is async. Also there is some info in the tokio tutorial about when to use async mutex I don't really understand (see On using std::sync::Mutex here: https://tokio.rs/tokio/tutorial/shared-state).

Also in this "audit" (https://www.reddit.com/r/rust/comments/f4zldz/i_audited_3_different_implementation_of_async/) parking_lot is shown as a sync example. So I guess the current implementation blocks the current thread whenever someone tries to acquire the lock?

Any idea which implementation is "right"?

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

1 participant