Skip to content

What are the possible reasons for deadlock of tokio::sync::Mutex? #5176

Answered by Darksonn
rise0chen asked this question in Q&A
Discussion options

You must be logged in to vote

The same reasons as any other mutex in any programming language. Any textbook on concurrency will talk about this.

The short story is that if you need to lock two mutexes at the same time, you must make sure that you always lock them in the same order. If you don't, then this is very likely to result in a deadlock.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hawkw
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