Browse Source

Add Adapter::inject_sync_shutdown() to be used if _adapter_manages_sync_thread

pull/8/head
heck 4 years ago
parent
commit
0517b9be69
  1. 8
      src/Adapter.cc
  2. 5
      src/Adapter.hh

8
src/Adapter.cc

@ -201,13 +201,19 @@ namespace pEp {
return _session.get(); return _session.get();
} }
// public
void inject_sync_shutdown() {
pEpLog("called");
_inject_sync_event(nullptr, nullptr);
}
// public // public
void shutdown() void shutdown()
{ {
pEpLog("called"); pEpLog("called");
if (_sync_thread.joinable()) { if (_sync_thread.joinable()) {
pEpLog("sync_is_running - injecting null event"); pEpLog("sync_is_running - injecting null event");
_inject_sync_event(nullptr, nullptr); inject_sync_shutdown();
_sync_thread.join(); _sync_thread.join();
} }
} }

5
src/Adapter.hh

@ -77,6 +77,11 @@ namespace pEp {
extern thread_local Session session; extern thread_local Session session;
// only injects a NULL event into sync_event_queue
// Use this if adapter_manages_sync_thread
// Inject first, then join your thread.
void inject_sync_shutdown();
// injects a NULL event into sync_event_queue to denote sync thread to // injects a NULL event into sync_event_queue to denote sync thread to
// shutdown, and joins & removes the sync thread // shutdown, and joins & removes the sync thread
void shutdown(); void shutdown();

Loading…
Cancel
Save