diff --git a/Adapter.cc b/Adapter.cc index d2479cd..d108907 100644 --- a/Adapter.cc +++ b/Adapter.cc @@ -42,6 +42,14 @@ namespace pEp { ::utility::locked_queue< SYNC_EVENT, ::free_Sync_event > q; std::mutex m; + std::thread::id sync_thread_id() + { + if (_sync_thread) + return _sync_thread->get_id(); + else + return std::thread::id(); + } + int _inject_sync_event(SYNC_EVENT ev, void *management) { try { diff --git a/Adapter.hh b/Adapter.hh index 711cae3..41995fb 100644 --- a/Adapter.hh +++ b/Adapter.hh @@ -5,8 +5,9 @@ #include #include -#include +#include #include +#include namespace pEp { @@ -36,6 +37,9 @@ namespace pEp { // returns 'true' when called from the "sync" thread, 'false' otherwise. bool on_sync_thread(); + // returns the thread id of the sync thread + std::thread::id sync_thread_id(); + enum session_action { init, release