1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-05-19 07:13:34 -04:00

Fix bug in source detach model which resulted in deadlock.

This commit is contained in:
Gordon McCann 2023-04-02 09:26:34 -04:00
parent 88173a16cf
commit 7abe92582c
2 changed files with 9 additions and 2 deletions

View File

@ -100,9 +100,12 @@ namespace Specter {
SPEC_PROFILE_FUNCTION();
SPEC_INFO("Detaching physics data source...");
std::scoped_lock<std::mutex> guard(m_sourceMutex);
m_activeFlag = false;
m_source.reset(nullptr);
{
std::scoped_lock<std::mutex> guard(m_sourceMutex);
m_source.reset(nullptr);
}
if (m_physThread != nullptr && m_physThread->joinable())
{
m_physThread->join();

View File

@ -61,14 +61,18 @@ namespace Specter {
void RitualClient::Disconnect()
{
SPEC_INFO("Disconnecting...");
if (IsConnected())
{
asio::post(m_context, [this]() { m_socket.close(); });
}
SPEC_INFO("Disconnected...");
SPEC_INFO("Stopping...");
m_context.stop();
if (m_ioThread.joinable())
m_ioThread.join();
SPEC_INFO("Stopped...");
}
void RitualClient::ReadSize()