Skip to content

Help: passing lock objects to spawned tasks leads to deadlock #6253

Answered by wathenjiang
zhengtong0898 asked this question in Q&A
Discussion options

You must be logged in to vote

You do not have to know the detail of task switching, but you would better know use tokio::task::spawn_blocking function to run your loop{}. This is one of the key point of https://ryhl.io/blog/async-what-is-blocking/.

Your problem is not dealock issue.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@zhengtong0898
Comment options

@wathenjiang
Comment options

Answer selected by zhengtong0898
@Darksonn
Comment options

@zhengtong0898
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants