_dbus_connection_acquire_io_path lock

Thiago Macieira thiago at kde.org
Wed Nov 12 11:37:07 PST 2008

jaikumar Ganesh wrote:
>a) What exactly does the io_path lock accomplish ? Can the code be
> safely reentrant ?

One thread is blocking on a select call. Any activity on the socket will 
possibly make that thread wake up and, therefore, do some work.

Technically speaking, a simple "send" (without reply) could be done by 
acquiring a simple write lock on the socket, while not bothering with a 
read one.

But that's extremely complex to implement, given the possibility for 
deadlocks: some situations require reading only, some require writing 
only, some require both. So there's only one lock, for the entire socket: 
any I/O operation must acquire that lock.

>b) I have seen mentions of DBusWatch and DBusTimeout to use in such
> cases. Any pointers to some code samples ?

>c) Any other work arounds ?

No, you should use a real event loop integration if your application is 
not a trivial one (single threaded and only does blocking calls).

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20081112/04da20c7/attachment.pgp 

More information about the dbus mailing list