[Gtk-sharp-list] ThreadNotify

Miguel de Icaza miguel@ximian.com
10 Oct 2002 19:46:41 -0400


> Hmm, will it?  If we start with the assumption that you should be using
> a Queue to pass data back and forth between threads, then we're either
> going to have to assume that one call of the notify handler is
> equivalent to one call of NotifyMain(), in which case the GIO handler
> will/should consume all available data from the pipe instead of just one
> byte per invocation; or we're going to have to assume that you may have
> a backlog of data for each call of the handler, and it's up to you in
> your application to read as much from your private Queue as you want.

Well, the purpose of Threadnotify is to wake up the main loop to get
some work done.  The work is actually not specified, it is up to the
main loop to figure out what needs to be done.

So you still need an auxiliary data structure to pass this information. 
The only thing the ThreadNotify will help you with is to invoke a
delegate in the thread running Gtk, a delegate that is invoked by
triggering it from other threads.

> Perhaps these two could be combined in a ThreadNotifyQueue class, which
> will give you one callback per notify semantics, with a piece of user
> data from a queue, so that you don't have to worry about how the details
> are implemented (i.e. it could just emit the event as many times as
> there are items in the queue, up to some number, etc.)?
> 	- Vlad
> -- 
> Vladimir Vukicevic <vladimir@pobox.com>