Commit a4c2be95 authored by Sam Hocevar's avatar Sam Hocevar

* ./src/misc/variables.c: fixed a deadlock in command variables handling;

    we now release the variable lock before calling the command.
  * ./src/misc/threads.c: removed deprecated code.
parent d86bf0f4
......@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.22 2002/10/15 08:35:24 sam Exp $
* $Id: threads.c,v 1.23 2002/10/16 10:31:58 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -59,9 +59,6 @@ struct vlc_namedmutex_t
vlc_namedmutex_t *p_next;
};
static vlc_namedmutex_t *p_named_list = NULL;
static vlc_mutex_t named_lock;
/*****************************************************************************
* vlc_threads_init: initialize threads system
*****************************************************************************
......@@ -128,8 +125,6 @@ int __vlc_threads_init( vlc_object_t *p_this )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#endif
vlc_mutex_init( p_libvlc, &named_lock );
if( i_ret )
{
i_status = VLC_THREADS_ERROR;
......
......@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: variables.c,v 1.5 2002/10/15 12:30:01 sam Exp $
* $Id: variables.c,v 1.6 2002/10/16 10:31:58 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -284,12 +284,18 @@ int __var_Get( vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val )
case VLC_VAR_COMMAND:
if( p_this->p_vars[i_var].b_set )
{
int i_ret = ((int (*) (vlc_object_t *, char *, char *))
p_this->p_vars[i_var].val.p_address) (
p_this,
p_this->p_vars[i_var].psz_name,
p_val->psz_string );
/* We need this to avoid deadlocks */
int i_ret;
int (*pf_command) (vlc_object_t *, char *, char *) =
p_this->p_vars[i_var].val.p_address;
char *psz_cmd = strdup( p_this->p_vars[i_var].psz_name );
char *psz_arg = strdup( p_val->psz_string );
vlc_mutex_unlock( &p_this->var_lock );
i_ret = pf_command( p_this, psz_cmd, psz_arg );
free( psz_cmd );
free( psz_arg );
return i_ret;
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment