Replies: 4 comments
-
Edit: Sorry, hit |
Beta Was this translation helpful? Give feedback.
-
This matches all messages, including incoming method replies. You need a match rule that matches the right signal only:
|
Beta Was this translation helpful? Give feedback.
-
Actually, while the comment above is correct, that won't resolve the issue. I'd say this is a fundamental limitation of the blocking Connection. You're trying to use the blocking connection in a parallel/non-blocking way. Would it be possible for you to switch to the nonblock/Tokio module instead? Or optionally have two blocking Connections? |
Beta Was this translation helpful? Give feedback.
-
Thanks @diwic, I've opted to have a second blocking Connection behind a reentrant-mutex, so that when a add_match happens, the process loop is blocked until a response is received by the add_match then frees the connection to continue processing. As for async, they can't be used yet, as I'm retrofitting an existing library to use DBus over a very deprecated set of operations. |
Beta Was this translation helpful? Give feedback.
-
I'm having a hard time trying to wrap my head around this situation.
I've created a
blocking::SyncConnection::new_system()
that is used for querying a service. I would also like to listen for signals at the same time.Initially I tried
Part of the problem, is that, as the thread loops, it will process messages as soon as they come in. But
proxy.call_method()?;
may have it's reply consumed by the process function since it does not know thatcall_method
helper is waiting for a reply.Also, the
add_match
will also wait for a reply that also gets consumed by the thread callingprocess
on the connection, so that too my raise anErr
...It seems wrong that a work around is to add a mutex, that whenever a method is called on a connection, the thread may need check the mutex, and wait before calling
process
just to prevent replies from being dropped...Beta Was this translation helpful? Give feedback.
All reactions