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 disconnect all slots deadlock #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TolonUK
Copy link

@TolonUK TolonUK commented Feb 11, 2022

Fixes a deadlock between concurrent calls to connection::disconnect() and signal::disconnect_all_slots().

In invalidate_disconnector(), the mechanism to wait for the destruction of _shared_disconnector gets stuck if a connection object has promoted its disconnector weak_ptr, has called disconnect(std::size_t) on the signal and is waiting to acquire the mutex.

This resolves this issue by separating the reset of _shared_disconnector from the wait for its destruction, so that the latter can be done outside of the mutex lock.

The problem behaviour was replicated in the test "Concurrent disconnection does not deadlock", prior to resolving the issue.

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.

2 participants