Skip to content
Discussion options

You must be logged in to vote

the usual advice with async is that you can use sync locks so long as you don't hold them across await points.

That's true for those that only provide synchronous methods, e.g., DashMap or parking_lot. scc is different; its internal locks can be acquired either synchronously or asynchronously. The detailed scenario is described in the saa doc; in short, there is no guarantee that the lock owner task gets scheduled by the asynchronous runtime in case another task is blocking the executor.
-> Calling _sync methods when dropping a Future is still bad; cancelled Futures are dropped within an asynchronous executor.

Therefore, I'd suggest that you make _sync calls in a separate thread or a th…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mincrmatt12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants