Re: callbacks and locking
- From: Olexiy Avramchenko <ath beast stu cn ua>
- To: hugo hallqvist <hugha495 student liu se>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: callbacks and locking
- Date: Wed, 23 Oct 2002 17:38:44 +0300
hugo hallqvist wrote:
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();
I think you can do this. But its usefull only if you're doing long
processing
in *routine()* and wish another threads be able to use gtk stuff this time.
gdk_threads_enter();
return;
}
where X is
Hmm, X==routine() ? If so, the leave/enter is useless cause you run it
in one thread and lock (enter) occurs almost after the unlock (leave).
void X() {
lock_stuff();
gdk_threads_enter();
touch_gui_components();
gdk_threads_leave()
unlock_stuff();
return;
}
Olexiy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]