Skip to content

Commit cd3a7ac

Browse files
committed
Fix deadlock.
1 parent e82a393 commit cd3a7ac

File tree

1 file changed

+5
-0
lines changed
  • SerialPrograms/Source/Controllers/SerialPABotBase/Connection

1 file changed

+5
-0
lines changed

SerialPrograms/Source/Controllers/SerialPABotBase/Connection/PABotBase.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,12 @@ void PABotBase::cv_wait(Cancellable* cancellable, std::unique_lock<std::mutex>&
965965

966966
cancellable->add_cancel_listener(*this);
967967
m_cv.wait(lg);
968+
969+
// Unlock to remove. Otherwise, it may deadlock with "on_cancellable_cancel()"
970+
// being called from a listener callback.
971+
lg.unlock();
968972
cancellable->remove_cancel_listener(*this);
973+
lg.lock();
969974
}
970975

971976

0 commit comments

Comments
 (0)