-
Notifications
You must be signed in to change notification settings - Fork 143
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Async/await support? #86
Comments
I assume you mean async await for locking. V4 is releasing soon and eliminates locks which solves the problem. |
Wait, how does that work? Wouldn't a lock be required to ensure consistency? How would it handle concurrent inserts to the same value then? |
You can check out the experimental branch and the v4.0.0-rc3 version on crates.io which is the current release candidate. I spent a lot of time researching and carefully designing a lockfree hashtable. |
Oh that's pretty cool! How does it work without locks though? Is there a document that I can read? |
I have a technical writeup planned before the release that will be posted to the rust subreddit and that will be linked in the readme. It works by using pointer swap techniques mostly. Each entry in the table is a pointer and entries can atomically swapped with a CAS instruction. That said there are a myriad of techniques needed to make this fast and it's something you can easily write a PhD thesis on because of the complexity. |
Related to async/await support: Is it possible to make iter() Send, so you can iterate over a dashmap in an async function? |
It is not possible to make iter send due to how locks work. At the moment I would recommend seeing if V4 works for you as it's iterators are send. |
Nevermind, apparently they are not send at the moment but the v4s can theoretically impl send in the future. |
Yeah I am already on V4. If that's not something you are working on I might submit a pull request at some point. |
It looks to be safe to implement. All that need to be done is unsafe impl send and sync if both K and V are send and sync respectively. |
A PR would be appreciated. Make sure to merge into the experimental branch. |
I started looking at this but noticed the experimental branch is undergoing some changes right now. I will try to take a look again in a few days. |
Are we planning to support async/await? Would be really nice to be able to do something like:
The text was updated successfully, but these errors were encountered: