Re: Threads & popup windows under mswin

On Sun, 2004-06-13 at 15:25, Miguel Figueiredo wrote:
Hi John,

Please search the archives.

I can't :P 
Every time I try to search I get an error (

A while back I sent one email (
gtk-app-devel-list/2004-April/msg00023.html) to the list, and Peter Krueger 
suggested the use of threads if the task was time consumming (http:// 

The GUI that I am building will download stuff from the internet, and while 
resolving, connecting and receiving data, it is not very responsive when not 
using threads.

Do you have a different suggestion?

There was a reply to your post that was a very good idea.  In windows,
only one thread can interact with the gui.  Therefore, you'll need to
just have one thread that listens for windows messages from the other
threads and then updates the gui accordingly.  Then in your worker
threads, when things need to be update, post a message to your main gui
thread's queue, asking for the update.  This is pretty much the only way
to do this, and this is what I had to do back when I dabbled in MFC
programming (what a nightmare).

The problem is that I can't tell you exactly how to do all this (the
inter-thread communication) under windows.

Have  you considered using the gnet library (from  This library will let you do
single-threaded asynchronous i/o within a nice glib framework.  While
asynchronous I/O is sometimes harder to understand than threaded at
first (it's event-driven), sometimes it is just cleaner and simpler when
you do the implementation.  Plus it eliminates the need for multiple
threads while still being able to handle many types of network I/O



Michael Torrie <torriem chem byu edu>

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