Tracking DBusWatches

tsuraan tsuraan at gmail.com
Fri Feb 9 15:17:49 PST 2007


> No. The correct solution would be a proper mainloop implementation.
> There's no need for an extra thread.

What purpose does a "proper mainloop" serve?  Is the idea to actually
run the entire application in a single thread?  Most of the computers
I use are dual or quad processor computers, so it would be a pity to
have my entire program in a single thread.

>
> If you prefer to use a thread, you need a communication mechanism. That's
> where the pipe comes in.
>
> That's hardly hackish at all, since both major toolkits use that for
> waking up mainloops. In fact, as far as I know, that's the only way of
> properly and reliably interrupting a select(2)/poll(2) call. (With a
> signal, you don't know if the signal was delivered on time or if it
> interrupted the system call)

Ok, this makes sense.

> Remember that you're comparing that to no activity at all. If it takes 2
> minutes for the next message to come in, your program woke up 1199 times
> too many.
>
> Now imagine that being done constantly by 10 programs. I call that
> unacceptable load when a proper solution is available.

I'm working on a proper select() based implementation now, so good arguments :)


More information about the dbus mailing list