diff --git a/Adapter.cc b/Adapter.cc index 599edd9..0eeb386 100644 --- a/Adapter.cc +++ b/Adapter.cc @@ -78,6 +78,11 @@ namespace pEp { return _session; } + void Adapter::shutdown() + { + _inject_sync_event(nullptr, nullptr); + } + int Adapter::_inject_sync_event(SYNC_EVENT ev, void *management) { if (is_sync_thread(session())) { diff --git a/Adapter.hh b/Adapter.hh index ac9e7da..f5990e1 100644 --- a/Adapter.hh +++ b/Adapter.hh @@ -24,13 +24,9 @@ namespace pEp { init, release }; - static PEP_SESSION session(session_action action = init); - static ::utility::locked_queue< SYNC_EVENT >& queue() - { - static ::utility::locked_queue< SYNC_EVENT > q; - return q; - } + + void shutdown(); protected: static int _inject_sync_event(SYNC_EVENT ev, void *management); @@ -38,6 +34,12 @@ namespace pEp { static void sync_thread(void *obj); private: + static ::utility::locked_queue< SYNC_EVENT >& queue() + { + static ::utility::locked_queue< SYNC_EVENT > q; + return q; + } + static std::mutex& mtx() { static std::mutex m;