Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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