Re: GEvent - Proposal for a new threading structure for GLib

Am Freitag, den 17.11.2006, 11:57 -0500 schrieb Matthew Barnes:
> On Fri, 2006-11-17 at 17:32 +0100, Murray Cumming wrote:
> > This seems similar to a class we have in glibmm, Glib::Dispatcher:
> >
> > though that uses pipes to get some kind of locking for free. I didn't
> > imlpement it. It's quite popular.
> Yeah, Evolution-Data-Server has something similar called an EMsgPort
> which uses pipes to help cancel blocking I/O operations.  But using
> pipes for simple thread synchronization doesn't scale well, since the
> operating system limits the number of open file descriptors.

Yup.  Glib::Dispatcher addresses this by sharing a single pipe for each
receiving thread.  The sending thread simply passes along a pointer to
the desired dispatcher object when writing to the pipe.

Thus, for the common use case of a single GUI server thread only one
pipe is needed.  In the worst case of every single thread dispatching
messages to each one of the other threads you'd end up with n! pipes,
where n = number of threads.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]