Re: ... multithreaded application with GTK+...



Message: 8
Date: Wed, 1 Sep 2004 16:26:21 +0300
From: Andrew Kirillov <andrew postmet com>
Subject: GTK+ & GLib  threads
To: gtk-app-devel-list gnome org
Message-ID: <6222999359 20040901162621 postmet com>
Content-Type: text/plain; charset=us-ascii

Hello.

I am writing a multithreaded application. There are two threads:
1) default thread for GUI and 2) a background thread, which downloads
something from network. Sometimes I need to update some widgets
depending on current state of the background thread. I am using a call
to gtk_widget_queue_draw() from the background thread. Then the widget
must receive the expose event and to draw something in the main
thread. All works fine, but not so long. After some time the widget
does not receive expose event any more. The background work performs
as before, but the call to my callback for expose event does not
occur. More of it - some widgets, menu for example, are not updated
after it.

What happens ? Any ideas ?
What is a safe method to invalidate some widgets from a background
thread ?

  

-- 
Best regards,
 Andrew                          mailto:andrew postmet com


Hi. 
IMHO, solution may be using queue. Background application may push
some info to queue (in their own thread) for instance using "global"
GList. Than thread that makes GUI changes may query that GList and do
proper work. This queue handler (in GUI thread) may be launched by
gtk_idle_...

Kozlitin Ihor
e-mail: kihor postmark net 



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