Making asynchronous calls
Robert Rawlins
robert_rawlins at hotmail.com
Thu Feb 7 07:06:47 PST 2008
Simon McVittie Wrote:
> The fact that there are these callbacks, which can be used to return the> results later, is exactly what makes your service implementation> asynchronous - otherwise, there is no way to return from your> implementation to the main loop (so more requests can be processed) without> returning a value for the D-Bus call.Ok, that makes perfect sense to me, I've now made a few changes and it appears to be calling my callbacks just fine with any results and errors. However, it still doesn't seem to be very async. If I do a call to a dead server again, I still get it queuing the other requests. My code at the moments looks something like this:
@dbus.service.method("com.example.SampleInterface",in_signature='s', out_signature='n',async_callbacks=('reply_cb', 'error_cb'))
def HelloWorld(self, address, reply_cb, error_cb):
def timeout_func():
#Call To Web Service Goes Here
reply_cb(ReturnResultFromWebServiceCall)
return False
gobject.timeout_add(500, timeout_func)
Does that look correct? or am I missing something? I looked at the examples you suggested in the test documents and they all looked to be of a very similar nature to what you gave me in your post an hour so back, and to the code snippet I have above.
> (Oh, and please tell your mail client to wrap long lines :-P )
Sorry about that, I'm using bloody windows LiveMail and I guess it must be screwing things up, sorry.
Cheers Simon,
Robert
_________________________________________________________________
Share what Santa brought you
https://www.mycooluncool.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080207/7b3c75c5/attachment.html
More information about the dbus
mailing list