neighbor/udisks2: use SafeSingleton for managing the ODBus::Glue instance

Allows other objects to use the same single instance as well.
This commit is contained in:
Max Kellermann 2018-06-03 09:37:34 +02:00
parent f3ffdaf21f
commit c60b50b1ae
1 changed files with 3 additions and 2 deletions

View File

@ -32,6 +32,7 @@
#include "neighbor/Listener.hxx" #include "neighbor/Listener.hxx"
#include "neighbor/Info.hxx" #include "neighbor/Info.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "thread/SafeSingleton.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
#include "util/Manual.hxx" #include "util/Manual.hxx"
@ -74,7 +75,7 @@ class UdisksNeighborExplorer final
EventLoop &event_loop; EventLoop &event_loop;
Manual<ODBus::Glue> dbus_glue; Manual<SafeSingleton<ODBus::Glue>> dbus_glue;
ODBus::PendingCall pending_list_call; ODBus::PendingCall pending_list_call;
@ -97,7 +98,7 @@ public:
} }
auto &&GetConnection() noexcept { auto &&GetConnection() noexcept {
return dbus_glue->GetConnection(); return dbus_glue.Get()->GetConnection();
} }
/* virtual methods from class NeighborExplorer */ /* virtual methods from class NeighborExplorer */