[dbus][python] Method dispatch also single-threaded?

John (J5) Palmieri johnp at redhat.com
Mon Jan 22 15:08:56 PST 2007

On Mon, 2007-01-22 at 16:49 -0600, tsuraan wrote:
>         Well if your service object isn't returning to the mainloop or
>         starting
>         up a thread it isn't going to process the next call until it
>         is done 
>         with the first call.   Async calls only have to do with making
>         sure the
>         client doesn't block.  If you don't want your server to block
>         on long
>         running calls you need to return to the mainloop sooner than
>         later.  It 
>         is the same issue as with gui blocking.  If you call a
>         function which
>         doesn't return to the mainloop your application's gui doesn't
>         respond.
>         You need to either run your calculations in a thread or defer
>         sending a 
>         reply and doing your calculations in an idle
>         handler.  Remember though,
>         you have around 25 seconds to get an answer back to the client
>         if it
>         uses the default timeout.
> So, in order for my example to work, each of the functions would need
> to set a timer, probably to emit a dbus signal, and then return
> immediately?  Normally, server frameworks offer some sort of
> threaded-reply model so that the core dispatcher doesn't block when a
> handler function misbehaves.  I take it that's impossible with the
> current dbus/glib mainloop, because everything has to be done
> cooperatively, right? 

I don't know the code off hand but there is a way to do an async reply
which basically hands you off an object which you use when you are ready
to reply and doesn't send a reply automatically.  Look at the code, it
is in the decorator.  Something like async_reply=True. 

John (J5) Palmieri <johnp at redhat.com>

More information about the dbus mailing list