deadlock
- From: Dirk Huenniger <dhun astro uni-bonn de>
- To: gtk-app-devel-list gnome org
- Subject: deadlock
- Date: Thu, 10 Mar 2005 21:18:30 +0100 (CET)
Hello everybody,
My name is Dirk, I'm writing a control programm for a 1m telescope in
Germany. The current status of the device is periodically displayed in GTK
using a thread. When the user clicks the quit butten a callback routine is
started. At the same time my thread does a gtk_threads_enter(). But it
cannot enter because the callback is running so it waits inside the gtk_threads_enter
routine. My callback routine askes the thread to quit and waits for that
to happen. But the thread cannot react because it is waiting inside
gtk_threads_enter(). So everything is hanging now. I also
tried to quit my thread in a routine added with gtk_quit_add, it did not
help. But the following evil hack worked:
/* my callback routine*/
menu_exit (GtkMenuItem *menuitem,
gpointer user_data)
{
gdk_threads_leave(); /* give back gdk "semaphore" ?????*/
thread_stop(); /* let thread take it and give it back*/
gdk_threads_enter(); /* take it again*/
}
Is there any better solution to this problem?
Yours
Dirk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]