summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-06-03 10:08:11 +0200
committerMax Kellermann <max@musicpd.org>2018-06-03 10:08:11 +0200
commit32064a23c1ed5e4f423e02ee624a03f9b76e54df (patch)
tree57c8187a2677876ba36b7bdfd357df04c895d98f /src
parentc60b50b1ae67c4d1e7c0dfbeb3303771f2563df3 (diff)
neighbor/udisks2: move Open()/Close() calls into the I/O thread
Fixes assertion failure.
Diffstat (limited to 'src')
-rw-r--r--src/neighbor/plugins/UdisksNeighborPlugin.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/neighbor/plugins/UdisksNeighborPlugin.cxx b/src/neighbor/plugins/UdisksNeighborPlugin.cxx
index b9ce00b3e..3a4559584 100644
--- a/src/neighbor/plugins/UdisksNeighborPlugin.cxx
+++ b/src/neighbor/plugins/UdisksNeighborPlugin.cxx
@@ -31,6 +31,7 @@
#include "neighbor/Explorer.hxx"
#include "neighbor/Listener.hxx"
#include "neighbor/Info.hxx"
+#include "event/Call.hxx"
#include "thread/Mutex.hxx"
#include "thread/SafeSingleton.hxx"
#include "util/Domain.hxx"
@@ -107,6 +108,9 @@ public:
List GetList() const noexcept override;
private:
+ void DoOpen();
+ void DoClose() noexcept;
+
void Insert(UdisksObject &&o) noexcept;
void Remove(const std::string &path) noexcept;
@@ -125,8 +129,8 @@ private:
void *user_data) noexcept;
};
-void
-UdisksNeighborExplorer::Open()
+inline void
+UdisksNeighborExplorer::DoOpen()
{
using namespace ODBus;
@@ -160,10 +164,14 @@ UdisksNeighborExplorer::Open()
}
void
-UdisksNeighborExplorer::Close() noexcept
+UdisksNeighborExplorer::Open()
{
- using namespace ODBus;
+ BlockingCall(GetEventLoop(), [this](){ DoOpen(); });
+}
+inline void
+UdisksNeighborExplorer::DoClose() noexcept
+{
if (pending_list_call) {
pending_list_call.Cancel();
}
@@ -174,6 +182,12 @@ UdisksNeighborExplorer::Close() noexcept
dbus_glue.Destruct();
}
+void
+UdisksNeighborExplorer::Close() noexcept
+{
+ BlockingCall(GetEventLoop(), [this](){ DoClose(); });
+}
+
template<typename I>
gcc_pure
static const char *