Async DBusMessage reads using the C API

Havoc Pennington hp at redhat.com
Tue Nov 1 18:59:30 PST 2005


On Tue, 2005-11-01 at 20:25 +0000, Matthew Johnson wrote:
> 
> Yeah, I was wondering whether to do that. You definitely want it to be
> non-blocking though. There's a lot of applications where the thread Must
> Not Block or bad things will happen (I'm thinking of two applications
> I'm involved with atm, one of which is having problems with a library 
> which doesn't cope with non-blocking IO).
> 

Well, you have to either block on *something* or you have to busy-loop
or you have to exit (right? those are the only possible alternatives
when you have no immediate processing to do...)

I'd take a guess you mean you need to block on something else, so if you
block on the dbus socket you'll become unresponsive to the something
else. This is the problem a main loop is intended to solve (the main
loop just being an abstraction of
select()/poll()/WaitForMultipleObjects()) so you can block on multiple
things at once.

The other possible solution is the Java norm, i.e. one thread per thing
you might block on. dbus supports that model also.

Havoc




More information about the dbus mailing list