Re: GTK+ thread problem (program freezing using these 2 GTK+ commands...)
- From: seberino spawar navy mil
- To: Bharat Bhushan <bharat CS Arizona EDU>
- Cc: gtk-list gnome org
- Subject: Re: GTK+ thread problem (program freezing using these 2 GTK+ commands...)
- Date: Thu, 31 Jul 2003 22:14:17 -0700
Thanks for the help. I read the URL you gave me and I couldn't find where it
explicitly said not to use gdk.threads_enter() and gdk.threads_leave()
when gtk main loop was running. However, I think this is a good idea.
The best overall solution seems to be to put all GTK+ commands in
main/parent thread and never in child threads. Then I can forget
about gdk.threads_enter() and gdk.threads_leave() because no other
thread will ever clash with the GUI work (1 thread has GTK+ stuff only.).
Thanks again.
Chris
On Thu, Jul 31, 2003 at 05:34:05PM -0700, Bharat Bhushan wrote:
> We cannnot use gdk.threads_enter() and gdk.threads_leave() blindly. You
> need to understand why / when these functions are used, otherwise the
> program will freeze. For example, you cannot use these functions when
> gtk main loop is running (like it does when we call gtk_dialog_run(),
> for example). There is decent documentation abt it at:
>
> http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html
>
> good luck,
> Bharat
> --------------------------------------------------------------------------------
>
>
> On Thu, 31 Jul 2003 seberino spawar navy mil wrote:
>
> > We have a Python GTK+ program that uses threads.
> > If we DON'T run the GTK+ GUI
> > code then multitasking is fine and every thread gets a little CPU time.
> >
> > If we run a GTK+ GUI in the main parent process/thread then program
> > freezes.
> >
> > The PyGTK commands called gtk.threads.thread_enter() and
> > gtk.gdk.threads_leave() are used to avoid conflicts caused by
> > two threads writing to GUI at the same time. The disallow/allow
> > other threads to write to GUI as needed.
> >
> > It would seem that the problem are with these two commands but
> > we cannot seem to find the problem. As you know, threads
> > are not the easiest things to debug.
> >
> > We are wondering if Python threads are unstable.
> > Are they??
> >
> > Any ideas at all how to begin to solve this?
> >
> > Chris
> >
> > --
> > _______________________________________
> >
> > Christian Seberino, Ph.D.
> > SPAWAR Systems Center San Diego
> > Code 2872
> > 49258 Mills Street, Room 158
> > San Diego, CA 92152-5385
> > U.S.A.
> >
> > Phone: (619) 553-9973
> > Fax : (619) 553-6521
> > Email: seberino spawar navy mil
> > _______________________________________
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
--
_______________________________________
Christian Seberino, Ph.D.
SPAWAR Systems Center San Diego
Code 2872
49258 Mills Street, Room 158
San Diego, CA 92152-5385
U.S.A.
Phone: (619) 553-9973
Fax : (619) 553-6521
Email: seberino spawar navy mil
_______________________________________
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]