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

Avoid a deadlock in DBusConnection.HandleMessage #113

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

qmfrederik
Copy link
Contributor

DBusConnection.HandleMessage will invoke TaskCompletionSource<Message>.SetResult. This can cause the continuation of that task completion source to be invoked synchronously. This can cause the calling code (i.e. code which invoked a D-Bus method using Tmds.DBus) to delay or block the execution of the HandleMessage method and, as such, the entire D-Bus message loop.

Specify TaskCreationOptions.RunContinuationsAsynchronously when creating the TaskCompletionSource helps avoid this issue.

`DBusConnection.HandleMessage` will invoke `TaskCompletionSource<Message>.SetResult`. This can cause the continuation of that task completion source to be invoked synchronously. This can cause the calling code (i.e. code which invoked a D-Bus method using Tmds.DBus) to delay or block the execution of the `HandleMessage` method and, as such, the entire D-Bus message loop.

Specify `TaskCreationOptions.RunContinuationsAsynchronously` when creating the `TaskCompletionSource` helps avoid this issue.
@tmds
Copy link
Owner

tmds commented Dec 21, 2021

Thank you, @qmfrederik!

@tmds tmds merged commit 26deb68 into tmds:master Dec 21, 2021
@tmds
Copy link
Owner

tmds commented Jan 25, 2022

This is part of 0.10.1 which was just published to nuget.org.

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.

None yet

2 participants