Re: [gtk-list] Re: can timers interrupt my code?



>Using GDK_THREADS_ENTER()/LEAVE() in a non-threaded application
>is not going to work.

My applications these days are always threaded.

>GDK_THREADS_ENTER()/LEAVE() do nothing if you haven't called
>g_thread_init().
>
>If you have called g_thread_init(), then imagine if the main

I have, at least in programs that do this. Since I don't this (timer
signal handling) very often, I mostly don't use g_thread_init(), even
in multithreaded programs.

>thread is holding the GDK lock when your itimer is called.
>
>Then your itimer routine is going to block waiting for the
>main thread to release the lock, but the main thread isn't
>running, so that lock will never be released.

It will for me, because I always run GTK/GDK/glib in a separate
thread.

Good explanation though. It doesn't apply in my case, but I should
have made it more clear that I run GTK/GDK in its own thread.

BTW: you might want to mention this to Tim Janik, because I took the
methodology from BSE, which as I understand is not multithreaded.

--p



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