Fwd: Circular calls with DBUS
Rob Taylor
rob.taylor at codethink.co.uk
Fri Mar 23 09:33:24 PDT 2007
John (J5) Palmieri wrote:
> On Fri, 2007-03-23 at 15:30 +0000, Rob Taylor wrote:
>> Jacques Guillou wrote:
>>> Is there a way to configure the GLib binding in such a way that an incoming
>>> message can be preocessed even if the main loop execution is stopped into a
>>> synchronous call (waiting for its answer) ?
>>> Would that be safe ?
>>>
>>> I really think using asynchronous calls only would make a system much more
>>> complex than it would be if synchronous calls were allowed.
>>>
>> Async call handling is the only way to (possibly) totally avoid
>> deadlock, any other scheme leads to subtle deadlock cases (see mailing
>> list history for a discussion of this, in respect to DCOP deadlock
>> breaking).
>>
>> Note that only code providing objects on the bus needs to use async
>> calling, normal clients can still use synchronous calls.
>
> I never like to say this because of the "programmers are lazy" syndrome.
> I think learning how to do async calls and using them everywhere will
> make them much easier to deal with in the long run (sure mainloop event
> programming was once hard to deal with but when is the last time you
> wrote something serious without a mainloop?).
Yeah, I agree, it makes sense to encourage async usage everywhere for
glib based code, at least.
> That being said we should
> look at our bindings and figure out if there is a way to make chaining
> async calls easier. In python we could do something similar to twisted
> deferred methods.
Hmm, it may be a lack of imagination on my part, but for c, I can't
think of anything easier than callbacks :/ We could possibly do some
crazy multiple-stack coroutine-type stuff, I guess, but that'd be a
portability nightmare. Of course, running the mainloop when making
synchronous calls gives a pretty similar effect, but as Simon said, it
violates the principle of least surprise and also could lead to
unpredictable stack growth and interesting side effects. I gather this
is what Qt4 currently does, so I'd be interested to hear what Thiago has
to say on it.
Thanks,
Rob Taylor
Thanks,
Rob Taylor
More information about the dbus
mailing list