[Perl] Net::Dbus and thread

Guillaume lomig42 at gmail.com
Sun Jul 5 02:10:04 PDT 2009


2009/7/4 Daniel P. Berrange:

> I have never tried to use Perl threads, so I've not got any knowledge of
> specific bugs in Net-DBus with threads. As I understand it though perl
> keeps all data separate between threads.

That's the case, and that's why I was surprised my code did not work,
although the shared C code might indeed have introduced some trouble.

> I think the best thing to try, is to have completely separate connections
> to the bus in each thread.  The call:
>
>  $bus = Net::DBus->session
>
> actually re-uses an internal shared bus connection in libdbus.so. If you
> pass in the parameter 'private => 1' to Net::DBus->session, you'll get a
> 100% non-shared, private connection.

Spot on! It did the trick. Thanks a lot for this, that was exactly
what I needed, and I missed that in the documentation.

Guillaume


More information about the dbus mailing list