Re: [gtk-list] gdk_threads_enter is not reentrant



Hi Noel,

> I have a piece of code which may be run from a GTK callback or within
> a thread outside of gtk_main().  The problem is that
> gdk_threads_enter() is not reentrant.  It locks up if I call it within
> a callback function.  If I omit the lock, I could trash GTK internals.
> 
>     MyData::destroy() {
>         gdk_threads_enter();   // hangs if called withing a callback
>         free_some_gdk_data();  // but I need to lock to protect GTK
>         gdk_threads_leave();
>     }

So you need 2 functions, so what?

> Could gdk_threads_enter() be made reentrant?  You should be able to
> call it twice from the same thread without deadlock.  

Why make it slower just for this case, which happens rarely.

Bye,
Sebastian
-- 
Sebastian Wilhelmi                   |            här ovanför alla molnen
mailto:wilhelmi@ira.uka.de           |     är himmlen så förunderligt blå
http://goethe.ira.uka.de/~wilhelmi   |



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