Volker Birk 7 years ago
parent
commit
14a51c1c62
  1. 9
      Adapter.cc
  2. 4
      Adapter.hh

9
Adapter.cc

@ -30,7 +30,7 @@ namespace pEp {
std::thread *_sync_thread = nullptr;
Adapter::Adapter(messageToSend_t messageToSend,
notifyHandshake_t notifyHandshake)
notifyHandshake_t notifyHandshake, void *obj)
{
if (messageToSend)
_messageToSend = messageToSend;
@ -44,7 +44,7 @@ namespace pEp {
lock_guard<mutex> lock(mtx());
if (!_sync_thread)
_sync_thread = new thread();
_sync_thread = new thread(sync_thread, obj);
}
}
@ -118,16 +118,17 @@ namespace pEp {
return queue().pop_front();
}
void Adapter::sync_thread()
void Adapter::sync_thread(void *obj)
{
PEP_STATUS status = register_sync_callbacks(session(), nullptr,
_notifyHandshake, _retrieve_next_sync_event);
throw_status(status);
do_sync_protocol(session(), nullptr);
do_sync_protocol(session(), obj);
unregister_sync_callbacks(session());
session(release);
_sync_thread = nullptr;
}
}

4
Adapter.hh

@ -17,7 +17,7 @@ namespace pEp {
public:
Adapter(messageToSend_t messageToSend,
notifyHandshake_t notifyHandshake);
notifyHandshake_t notifyHandshake, void *obj = nullptr);
virtual ~Adapter() { }
enum session_action {
@ -35,7 +35,7 @@ namespace pEp {
protected:
static int _inject_sync_event(SYNC_EVENT ev, void *management);
static SYNC_EVENT _retrieve_next_sync_event(void *management, time_t threshold);
static void sync_thread();
static void sync_thread(void *obj);
private:
static std::mutex& mtx()

Loading…
Cancel
Save