Re: [gtk-list] Re: Making gtk thread-safe




On Wed, 30 Jul 1997, Jay Painter wrote:

> > Hmm.. this may be a silly question, but why would you create an
> > application that had multiple threads using gtk ?  I would think the most
> > reasonable way to use threads in most programs would be to have one for
> > the gui, and others for doing I/O, processing tasks or what have you,
> > using IPC between them. 
> 
> Here's an example of somthing I'm doing that I'd like to use threads for:
> In my e-mail client, I have to fill a long list of e-mail messages,
> sometime 200-400 messages in a list.  This takes about 6-10 seconds on my
> Pentium.  I would really like to launch a thread to fill the list and run
> a status bar, and meanwhile the window kept itself re-painted and
> menus/sections responded when clicked (and I want to eat my cake too!!!).

Hmm.. couldn't this be done by using one thread to do the listing, and
communicate to the gui thread to update the status bar ?  I don't know
your exact implemenatin details, but perhaps a pipe could be used to
transfer the list to the gui (and update the status bar).  You could use
gdk_input_add on the pipe to collect data from it. 

> It would also be nice to dedicate a thread which just took care for
> certain standard events like redrawing and re-sizing windows, so that
> those functions would never be blocked. 

Hmm.. this I could see, but what can the user do while the resizing is
taking place anyway ? .. and it doesn't take to long.  If you using
a seperate thread to generate the list than that isn't stopped either..

Anyway, I don't want to destroy your ideas for improving gtk, just
pointing out that there's more than one way to do things :)

Ian



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