Merge branch 'master' into Release_2.1

Release_2.1
heck 2 years ago
commit 3dd36d3c5e

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

@ -77,6 +77,11 @@ namespace pEp {
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
// shutdown, and joins & removes the sync thread
void shutdown();

@ -7,6 +7,10 @@
#include <mutex>
#include <atomic>
#ifdef ANDROID
#include <android/log.h>
#endif
namespace pEp {
namespace Adapter {
@ -14,7 +18,7 @@ namespace pEp {
std::mutex mtx;
std::atomic_bool is_enabled{false};
std::atomic_bool is_enabled{ false };
void set_enabled(bool enabled)
{

@ -6,10 +6,6 @@
#include <sstream>
#include <thread>
#ifdef ANDROID
#include <android/log.h>
#endif
// pEpLog
// ======
// a "to be kept ultra small and simple" logging unit.
@ -36,12 +32,13 @@
do { \
} while (0)
#else
#define pEpLog(msg) \
do { \
std::stringstream msg_ss; \
msg_ss << std::this_thread::get_id() << " - " << __FILE__ << "::" << __FUNCTION__ << " - " << msg; \
pEp::Adapter::pEpLog::log(msg_ss.str()); \
} while(0)
#define pEpLog(msg) \
do { \
std::stringstream msg_ss; \
msg_ss << std::this_thread::get_id() << " - " << __FILE__ << "::" << __FUNCTION__ \
<< " - " << msg; \
pEp::Adapter::pEpLog::log(msg_ss.str()); \
} while (0)
#endif // NDEBUG
namespace pEp {

Loading…
Cancel
Save