Re: systemd-devel Digest, Vol 125, Issue 21

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mi, 09.09.20 10:51, 海阔天空 (858293230@xxxxxx) wrote:

> Hi All,
>
>
> Could you help with the question below?
> Does sd_dbus support non-blocking or multi-thread?

sd-bus is threads-aware, but not thread-safe. The idea is to allocate
a separate bus connection for each thread, and not share connections
between threads though.

if you want to receive asynchronous notifications via sd-bus, then you
need to invoke sd_bus_wait() + sd_bus_process() in a loop (possibly
interleaved with other calls), or use an event loop of some form, for
example sd-event.

If you invoke usleep() or similar long-blocking syscalls from a thread
that also is supposed to run your bus connection then of course the
processing of the bus connection cannot take place then.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux