[vlc-devel] [RFC] Deadlock situation in input.c in create( ... ), with playlist

Rafaël Carré funman at videolan.org
Sun Mar 16 00:08:51 CET 2008

On Sat, 2008-03-15 at 23:32 +0100, Andre Weber wrote:
> Hello,
> we have a deadlock situation in the function
> input.c - in the method
>    static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
>                                    const char *psz_header, vlc_bool_t b_quick, sout_instance_t *p_sout )
> the deadlock occurs durring the /* Parse input options */ code, for normal files it couldn't happen
> but if you try to open a avi with subtitles, or open the Direct Show streaming on windows f.e.
> (just checking the subtitles options without haveing them is sufficent to get the deadlock)
> and you have the "security policy" set to "ask" - we are stuck in this code block:
>     /* Parse input options */
>     vlc_mutex_lock( &p_item->lock );
>     for( i = 0; i < p_item->i_options; i++ )
>         var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i] );
>     vlc_mutex_unlock( &p_item->lock );
> because var_OptionParse( ... ) calls the function intf_UserYesNo( ... ) this function tries to show a dialog
> the event to do this is passed through the thread loop of the playlist thread.c function RunControlThread( ... )
> but at this time - the thread is still in the function playlist_MainLoop( .. )  and is waiting for the completion
> of the method playlist_PlayItem( ... )  --> and this functions waits for the return of var_OptionParse( ... )
> and so long this is running the thread loop couldn't process the call to intf_InteractionManage( ... )

I don't understand what's the link between interaction and playlist, so
the interaction just should be moved in its own thread.

Also I notice that playlist_MainLoop() is not a loop ... the loop is

> We (Atmo & Ivoire) tried to move the var_OptionParse( ... ) into the input thread - from the logic
> that shouldn't make any difference - but this also didn't work - because inside the thread we failed
> on the locked playlist mutex inside the function  interaction.c : InteractionGet( ... ) ... that was the
> point where I gave up ... without any idea - which wouldn't be a hack or kludge.
> (I tried to unlock the playlist durring thread creation but that didn't helped ...)
> Any ideas are welcome? funman whats about you?

I think moving the interaction in its own thread (in libvlc) is the solution (and it could be disabled if --interact is false)

Rafaël Carré <funman at videolan.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080316/4332c830/attachment.sig>

More information about the vlc-devel mailing list