Asynchronous method calls
luigi at lambrate.inaf.it
Wed May 9 03:02:46 PDT 2007
I have a question which is specific for the dbus-python bindings, but I
think it can be viewed as a general issue.
Suppose I have an object which exposes a method myMethod(arg1, arg2,
...). Now I want to call it 3 times asynchronously with different
arguments each time:
call 1: myMethod(1, 2, 3, ...)
call 2: myMethod(6, 2, 4, ...)
call 3: myMethod(8, 10, 3, ...)
Using reply_handler and error_handler I easily link the responses to a
suitable callback function. As a result I can have 3 callbacks which are
in a different time order respect the calls:
response 1: callback of call 2
response 2: callback of call 3
response 3: callback of call 1
The problem is that I cannot recognize each response to which original
call are related (and sometime it can be important). I could do it
passing a call ID as an argument and getting it from the response, but
I'm wondering whether there could be another inner mechanism in DBus
itself or not.
Thank you in advance.
More information about the dbus