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

fix: wrap dashmap in Arc #1624

Merged
merged 1 commit into from
Nov 6, 2024
Merged

fix: wrap dashmap in Arc #1624

merged 1 commit into from
Nov 6, 2024

Conversation

mattsse
Copy link
Member

@mattsse mattsse commented Nov 6, 2024

ref #1491

dashmap is clone, which imo is a footgun, because dashmap acts as Rwlock<HashMap> not Arc<Rwlock<HashMap>>

DashMap tries to be very simple to use and to be a direct replacement for RwLock<HashMap<K, V>>. To accomplish this, all methods take &self instead of modifying methods taking &mut self. This allows you to put a DashMap in an Arc and share it between threads while being able to modify it.

@mattsse mattsse merged commit 560f052 into main Nov 6, 2024
26 checks passed
@mattsse mattsse deleted the matt/wrap-dashmap-in-arc2 branch November 6, 2024 11:40
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.

2 participants