lib/dbus/Glue: move Connect()/Disconnect() calls to I/O thread

This commit is contained in:
Max Kellermann 2018-06-03 12:00:16 +02:00
parent d58d65ebf0
commit 37e25f93d6
2 changed files with 18 additions and 2 deletions

View File

@ -19,9 +19,22 @@
#include "config.h"
#include "Glue.hxx"
#include "event/Call.hxx"
namespace ODBus {
void
Glue::ConnectIndirect()
{
BlockingCall(GetEventLoop(), [this](){ Connect(); });
}
void
Glue::DisconnectIndirect()
{
BlockingCall(GetEventLoop(), [this](){ Disconnect(); });
}
void
Glue::Connect()
{

View File

@ -35,11 +35,11 @@ class Glue final : ODBus::WatchManagerObserver {
public:
explicit Glue(EventLoop &event_loop)
:watch(event_loop, *this) {
Connect();
ConnectIndirect();
}
~Glue() noexcept {
Disconnect();
DisconnectIndirect();
}
EventLoop &GetEventLoop() noexcept {
@ -51,6 +51,9 @@ public:
}
private:
void ConnectIndirect();
void DisconnectIndirect();
void Connect();
void Disconnect();