callbacks and locking



Hi,

I'm trying to write an gtkprogram with multiplethreads, all has worked
fine up until now where I have run into problems.

I would like to know if it is ok to do gdk_threads_leave() / _enter()
inside a callback to a gui-button. Is this ok, or will it ruin gtk's
internal state?

like this

gint cb_download_ordinary_new_queue(GtkWidget *widget, gpointer data) {

init blah blah..

gdk_threads_leave();

routine();

gdk_threads_enter();

return;

}

where X is

void X() {
lock_stuff();
gdk_threads_enter();
touch_gui_components();
gdk_threads_leave()
unlock_stuff();
return;
}

Regards,

//Hugo Hallqvist



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