Re: DBUS - how to handle muliple bus-message in parallel
Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Organization | Geek Central |
| Message-ID | <[email protected]> |
On Tue, 21 Aug 2018 15:57:27 +0100, Simon McVittie wrote: > Either that, or use an event loop (for example the GLib main loop) > to defer the actual work to happen later, and send the reply when the > actual work has been done. For example, this is very common in > programs that do some mixture of D-Bus, networking and GUIs. Depends on where the bottleneck is; if your code is CPU-intensive, then you probably have to use threads. But if you are spending a lot of time waiting for things to happen elsewhere (I/O transfers, user responses to GUI displays), then yes, it would be simpler to avoid threading. > More specialized implementations like GDBus > can assume that you are using "their" event loop, which makes them > simpler to use and easier to get right. libdbus suffers from being > too generic: it has all the necessary parts to be connected to a > third-party event loop, but does not make it easy or obvious, because > it supports all event loops equally well (or to put it another way, > equally badly). This is why it is good to move towards an “event-loop-agnostic” model, where event loops conform to a generic API (e.g. Python’s asyncio) which makes it easy to swap them out <https://lists.freedesktop.org/archives/dbus/2017-October/017329.html>. _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus