From d4d114ff153abe124fad4e07eebd264d350b7c2e Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Tue, 7 Jul 2020 09:53:01 +0200 Subject: [PATCH] JSON adapter needs this --- Adapter.cc | 8 ++++++++ Adapter.hh | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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