Methods need always return values?

Robert Rawlins robert_rawlins at hotmail.com
Tue Apr 15 07:45:40 PDT 2008


Hi Simon,
 
Your solution seems to be exactly what I was looking for :-) However, I wonder if you can answer this question on the same subject for me.
 
At the moment I'm returning from the method immediately and then performing some long running tasks, then emitting some signals when they are complete. By returning a value immediately it means the DBUS method call doesn't timeout whilst the processes in the method take some time to run. The problem which occurs is due to the fact that I need to use 'context' later on in the method, this means it crashes my application with a segfault, presumably because 'context' has already been returned.
 
For Example:
 
gboolean
this_is_my_method(......DBusGMethodInvocation *context)
    dbus_g_method_return (context);
 
    ...... do some really long running processes.
 
    call_a_function_which_needs_context(context)
 
    .... emit my signals here.
 
Does that make sense? how can I avoid this issue? The only way I can see at the moment is to move dbus_g_method_return (context); to the bottom of the method, however, this will cause my client application to receive DBUS timeout errors when calling this method as the processes within it are so slow.
 
I'd really welcome any suggestions.
 
Robert
_________________________________________________________________
Get Hotmail on your mobile. Text MSN to 63463 now!
http://mobile.uk.msn.com/pc/mail.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080415/f2e4480d/attachment.html 


More information about the dbus mailing list