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 once async sync_writes deadlock #175

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

Lesny
Copy link
Contributor

@Lesny Lesny commented Oct 31, 2023

fixes #174

Comment on lines +903 to +908
async fn once_sync_writes_a(s: &tokio::sync::Mutex<String>) -> String {
let mut guard = s.lock().await;
let results: String = (*guard).clone().to_string();
*guard = "consumed".to_string();
results.to_string()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use mutex here to verify that sync_writes really has an effect and that following calls will not execute inner.

@jaemk
Copy link
Owner

jaemk commented Nov 6, 2023

Good find. Thanks for putting in a fix!

@jaemk jaemk merged commit 31caa5c into jaemk:master Nov 6, 2023
1 check passed
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.

Once with sync_writes and async causes deadlocks in tokio.
2 participants