Thread safety

keith preston keithpre at gmail.com
Tue Sep 11 14:22:51 PDT 2007


> I would say that some functions aren't meant to be thread-safe and  I
> would qualify connection setup functions as such.
>
> You should finish setting up the connection (connect, handshake, set
> timeout and watch callbacks) before any other thread gets to use the
> connection.


 This isn't just used as a connection setup function,
protected_change_timeout gets called every time you do a
dbus_connection_send_with_reply ->
_dbus_connection_attach_pending_call_unlocked ->
_dbus_pending_call_add_timeout_unlocked -> protected_change_timeout.

So if you do a dbus_connection_send_with_reply with multiple threads fast
enough and often enough you will always see an "Out of Memory" error, since
that is the way problems are reported.   It's pretty simple to test, just
make a bunch of threads that just repeat the same call over and over,
eventually it will happen.

Keith Preston
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20070911/70c5308d/attachment.htm 


More information about the dbus mailing list