Re: Can someone help me get rid of XLib errors? please



On Mon, 2003-04-14 at 09:58, Douglas Ian Linder wrote:
> > if you grab a mutex lock around your gtk_main, then try to acquire the 
> > lock from within a call back (presumably executed by the gtk loop), 
> > won't you deadlock (the lock has already been acquired, and not yet 
> > released)?
> 
> At first glance it looks that way, which seems a bit weird, but if you
> look closely you'll see private object is a pointer; I'm guessing it's
> used to keep an array of mutex values.

Actually, it's much simpler ... GTK+ simply releases the lock while
running the main loop, and reacquires it when handling events from
the windowing system.

> Definately (because I actually tried after answering) if you put a
> lock around main you can still aquire the mutex using gtk_thread_enter()
> in your callbacks. If that's not how it works some strange stuff must be 
> going on inside gtk_main() some where...
>
> As to how many times you can pull this trick... I don't know. I guess
> it'd be interesting to see what gtk_thread_enter() does immediately
> after a previous gtk_thread_enter() call... does it allocate and lock
> a new mutex, or deadlock? Haven't tried. I'm guessing the latter.

Deadlocks.

Regards,
                                               Owen





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