Re: understanding GTK thread capabilities
- From: Charles Kerr <charles superpimp org>
- To: kobyleski thierry <thierry kobyleski worldonline fr>
- Cc: gtk-list gnome org
- Subject: Re: understanding GTK thread capabilities
- Date: Tue, 20 Jun 2000 12:47:08 -0500
On Tue, Jun 20, 2000 at 07:23:56PM +0200, kobyleski thierry wrote:
> Can't someone confirm it is possible to do the following (just if it is
> possible):
> I press a button which starts a long work, and I need to see the cpu
> load in another widget in the same form. Is it possible to update the
> value of the cpu load in a label wigdet for example, while the callback
> from the button is still at work (and is not yet returned to the main
> loop).
Yes, this can be done.
The key hint is that all threads except the main one need to lock the
gdk before making the widget calls:
gdk_threads_enter ();
... widget work here ...
gdk_threads_leave();
glib callbacks (timeout, io callbacks, etc.) require this as well, but
gtk+-level callbacks (buttonpress signals, list selection, etc.) don't.
The gtk+ faq discusses this at http://www.gtk.org/faq/gtkfaq-5.html#ss5.2.
cheers,
Charles
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]