D-BUS in KDE
mike at navi.cx
Sat Nov 6 14:52:04 PST 2004
On Sat, 06 Nov 2004 11:50:00 -0500, Havoc Pennington wrote:
> Well, right now you can read a response from a different thread than you
> send it... thread-local storage could be useful with some of the API
> (e.g. the send_with_reply_and_block()) but in the API where a single
> call both sends and receives, you don't need TLS, you can just put
> something on the stack.
The thing with TLS/global variables is for when a call is made to a
server, arbitrary server code with whatever nesting is done and then the
server calls back to the client: how do you know the call serial after
you passed through arbitrary user code? You could force the user code to
pass it around all the time but that's a bit awkward. It lets you tie the
logical stacks together.
I agree though it only makes sense when you're using DBUS as an RPC system
(blocking calls) rather than a message passing system. In a pure messaging
system though I'm not sure the same re-entrancy concerns apply: if you're
reading responses from a different thread to that which made the call your
code is probably already expecting re-entrancy.
More information about the dbus