Replacing evil looping code

Thiago Macieira thiago at kde.org
Fri Nov 10 11:35:07 PST 2006


uwesmail2005-lkml at yahoo.de wrote:
>> No good, it's racy.
>
>It's not. 

Sorry, it is racy. Here's why:

>As long as the service starts up any calls to the method are 
>blocked, when it is started (got the name) the first message is
>handled.

Correct.

>By handling that message the name is given up, so no more messages are
>handled. The messages that are not yet delivered (flagged with the
>unique name/connection to ensure delivery) to the app will start up
>another instance. 

Not necessarily. Here's where the race condition enters: if the 
dbus-daemon receives those messages from other applications before the 
newly started service gives up the name, they'll be delivered to that 
service. No new instance will be started up.

>The messages that are already delivered (because of 
>buffering) could be re-called by the misdeliveree.

This part I didn't understand. What do you mean here? That the callee 
should report an error and the caller try again? What if it fails yet 
again?

-- 
  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: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061110/f7da2626/attachment.pgp


More information about the dbus mailing list