Browse Source

shutdown sync thread

LPA-1
Volker Birk 7 years ago
parent
commit
546c6a89f0
  1. 5
      Adapter.cc
  2. 14
      Adapter.hh

5
Adapter.cc

@ -78,6 +78,11 @@ namespace pEp {
return _session; return _session;
} }
void Adapter::shutdown()
{
_inject_sync_event(nullptr, nullptr);
}
int Adapter::_inject_sync_event(SYNC_EVENT ev, void *management) int Adapter::_inject_sync_event(SYNC_EVENT ev, void *management)
{ {
if (is_sync_thread(session())) { if (is_sync_thread(session())) {

14
Adapter.hh

@ -24,13 +24,9 @@ namespace pEp {
init, init,
release release
}; };
static PEP_SESSION session(session_action action = init); static PEP_SESSION session(session_action action = init);
static ::utility::locked_queue< SYNC_EVENT >& queue()
{ void shutdown();
static ::utility::locked_queue< SYNC_EVENT > q;
return q;
}
protected: protected:
static int _inject_sync_event(SYNC_EVENT ev, void *management); static int _inject_sync_event(SYNC_EVENT ev, void *management);
@ -38,6 +34,12 @@ namespace pEp {
static void sync_thread(void *obj); static void sync_thread(void *obj);
private: private:
static ::utility::locked_queue< SYNC_EVENT >& queue()
{
static ::utility::locked_queue< SYNC_EVENT > q;
return q;
}
static std::mutex& mtx() static std::mutex& mtx()
{ {
static std::mutex m; static std::mutex m;

Loading…
Cancel
Save