Re: [systemd-level]: How to share the same DBUS between the main process and the new thread?

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

 



On Do, 23.04.20 21:31, www (ouyangxuan10@xxxxxxx) wrote:

> Dear all,
>
>
> I write a new service and the service need wait the signal. At the same time, I need to start a new thread to get information. If the two share the same DBUS, the following problems will arise:
> terminate called after throwing an instance of 'sdbusplus::exception::SdBusError'
> what():  sd_bus_call: org.freedesktop.DBus.Error.Timeout: Connection timed out
>
>
> Is there any good way to solve this problem?
> (I don't want to create a new DBUS in a new thread.)

sd-bus is not thread-safe. Use a seprate connection for each
thread. You cannot share connections between multiple shares (unless
of course, you lock around it yourself)

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