Replacing evil looping code

uwesmail2005-lkml at yahoo.de uwesmail2005-lkml at yahoo.de
Tue Nov 14 00:12:37 PST 2006


--- Thiago Macieira <thiago at kde.org> schrieb:

> 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.
> 
Correct. That's what I mean below with "messages already delivered".
For
me the message is delivered to an app, when it is marked by the daemon
with the outgoing connection.
> >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
And this part is why it's not racy.
> 
> should report an error and the caller try again? What if it fails yet
> 
> again?
No the callee (because it knows that the message is not for him because
it hasn't the name anymore) does a "return name(args)", that is calls
the fuction for the caller again and so starts up the next instance.
> 
> -- 
>   Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
>     PGP/GPG: 0x6EF45358; fingerprint:
>     E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
> > _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
> 





	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de


More information about the dbus mailing list