Re: [gtkmm] One more time (yesterday:about threads)



In that program you have two threads: one for the gtk main loop (in the main function), and one you're creating in the constructor of your window1 class, the one that lives in the "thread" function. You will be doing things from those two threads, manually through the set_text in the latter function, and automatically through the X events coming to the main loop. If those two threads are not mutually excluded, you will have random crashes. You have two options: whether you serialize everything to execute X code always in the same thread, or you use gdk_threads_enter/gdk_threads_leave functions to mutex that code. Search this very list, this issue has been discussed before.

Leandro.

MIGUELMMC wrote:
Your answer: 
  
It seems you have a synchronization problem. You should mutex the access 
to Gtk, you can't have two Gtk threads running at the same time.
    

I don't understand.
I have a only thread (+Gtk::Main::run), where I mutex? what?
About my code, in the thread, when I write: set_text(...), all it's OK.,
but if I write pixmap->set(...) -> freeze! (thread is alive -> printf is
printing in shell) . What's happen?

Please, it's difficult for me, if you can send me any code...

Thanxs.


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

  


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