[sldev] Deadlock in llmedia
Carlo Wood
carlo at alinoe.com
Fri Jun 12 19:15:47 PDT 2009
Hiyas,
I'm trying to make LLFilePicker NOT lock up the viewer
(so that you lose connection if you don't quickly pick
a file).
In order to do that, I run it in it's own thread.
This means that GTK must be made thread safe, of course.
I made the necessary changes (I think) to the viewer
code to have a thread-safe GTK approach, basically
by initializing gdk for threads (that initialization
as completely missing) and calling gdk_threads_enter()
to take the main lock that gdk/gtk use. This lock
is kept at all time in the main thread / main loop,
except once per loop (usually inside gtk_main) where
it is released to let other threads run (which should
wrap their calls to gtk_* inside a gdk_threads_enter/leave).
Everything runs fine this way, and the viewer happily
continues to run even with a file picker window open,
until I start audio ...
Namely, LLMediaImplGStreamer::updateMedia calls
g_main_context_pending, which calls g_main_context_prepare
which seems to dead lock on the lock set by gdk_threads_enter
(I'm not sure it's the same lock, and it seems a bit weird
because g_* is not gdk... but releasing the lock with
gdk_threads_leave makes the dead lock disappear).
I'd like to try to release this main lock just prior
to calling g_main_context_pending(), but llmedia doesn't
include the gdk header path... and I have no idea how
to add this to cmake :/
So, my question is:
What do I have to change in wich cmake files do to be able
to call gdk_threads_enter/leave in llmedia/llmediaimplgstreamer.cpp ?
Thanks in advance for the help with part that
outside my expertise,
Carlo Wood <carlo at alinoe.com>
More information about the SLDev
mailing list