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

feat: change parking lot mutex to std mutex #315

Merged
merged 4 commits into from
Mar 20, 2023
Merged

Conversation

kemingy
Copy link
Member

@kemingy kemingy commented Mar 18, 2023

History: parking_lot used to be faster and smaller than the std mutex. But Rust 1.62 improved the std::sync::Mutex a lot.

Benefit:

This means that on platforms like Linux and Windows, the operating system will be responsible for managing the waiting queues of the locks, such that any kernel improvements and features like debugging facilities in this area are directly available for Rust programs.

@github-actions github-actions bot added the enhancement New feature or request label Mar 18, 2023
@kemingy kemingy requested a review from lkevinzc March 18, 2023 14:38
@kemingy kemingy enabled auto-merge March 18, 2023 14:38
@kemingy
Copy link
Member Author

kemingy commented Mar 18, 2023

One benefit of parking_lot: deadlock detection.

@kemingy
Copy link
Member Author

kemingy commented Mar 18, 2023

lkevinzc
lkevinzc previously approved these changes Mar 19, 2023
@kemingy kemingy disabled auto-merge March 19, 2023 04:29
@kemingy
Copy link
Member Author

kemingy commented Mar 20, 2023

One benefit of parking_lot: deadlock detection.

Loom has the std::sync::Mutex. For parking_lot, it seems we need to wrap it like tokio. Examples can be found in tokio repo.

Signed-off-by: Keming <kemingy94@gmail.com>
@kemingy kemingy enabled auto-merge March 20, 2023 06:21
@kemingy kemingy requested a review from lkevinzc March 20, 2023 06:22
@kemingy kemingy added this pull request to the merge queue Mar 20, 2023
@kemingy kemingy merged commit fc1fac3 into mosecorg:main Mar 20, 2023
@kemingy kemingy deleted the std/mutex branch March 20, 2023 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants