Skip to content

usage of parking_lot #1

Open
Open
@hffmnn

Description

@hffmnn

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"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions