diff --git a/callback_dispatcher.cc b/callback_dispatcher.cc index 92d955a..2213dbe 100644 --- a/callback_dispatcher.cc +++ b/callback_dispatcher.cc @@ -30,9 +30,11 @@ namespace pEp { targets.push_back({messageToSend, notifyHandshake, on_startup, shutdown}); - // try_unlock() possibly waiting messageToSend - sync_mtx.try_lock(); - sync_mtx.unlock(); + if (!Adapter::on_sync_thread()) { + // try_unlock() possibly waiting messageToSend + sync_mtx.try_lock(); + sync_mtx.unlock(); + } } void CallbackDispatcher::remove(::messageToSend_t messageToSend)