A libev based mainloop and lost signals

Thiago Macieira thiago at kde.org
Tue Aug 10 05:30:30 PDT 2010


Em Terça-feira 10 Agosto 2010, às 11:49:45, Rémi Denis-Courmont escreveu:
> On Tue, 10 Aug 2010 11:41:46 +0200, Thomas Themel <thomas at themel.com>
> 
> wrote:
> > My client code uses dbus_connection_send_with_reply_and_block to do
> 
> method
> 
> > calls on the server while the mainloop runs in another thread, is this a
> > good idea?
> 
> No. At least it won't work with the current libdbus (as far as I can tell).

This will cause a deadlock. Any such calls that loop back onto the same 
connection will be stuck for 25 seconds, then timeout, then be delivered.

It doesn't matter that another thread is listening, the _and_block function 
controls the socket.

To make this work, you must not use _and_block. You must instead use 
send_with_reply and make sure that the other thread doesn't pull your reply 
before you do.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      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: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100810/e298c65d/attachment.pgp>


More information about the dbus mailing list