Commit 2085be2a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Config lock is pointless while reading/resetting the configuration

parent baa37df2
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#endif #endif
#include <vlc_common.h> #include <vlc_common.h>
#include "../libvlc.h"
#include "vlc_keys.h" #include "vlc_keys.h"
#include "vlc_charset.h" #include "vlc_charset.h"
#include "vlc_configuration.h" #include "vlc_configuration.h"
...@@ -534,14 +533,9 @@ void config_UnsetCallbacks( module_config_t *p_new, size_t n ) ...@@ -534,14 +533,9 @@ void config_UnsetCallbacks( module_config_t *p_new, size_t n )
*****************************************************************************/ *****************************************************************************/
void __config_ResetAll( vlc_object_t *p_this ) void __config_ResetAll( vlc_object_t *p_this )
{ {
libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
module_t *p_module; module_t *p_module;
module_t **list = module_list_get (NULL); module_t **list = module_list_get (NULL);
/* Acquire config file lock */
vlc_mutex_lock( &priv->config_lock );
for (size_t j = 0; (p_module = list[j]) != NULL; j++) for (size_t j = 0; (p_module = list[j]) != NULL; j++)
{ {
if( p_module->b_submodule ) continue; if( p_module->b_submodule ) continue;
...@@ -568,5 +562,4 @@ void __config_ResetAll( vlc_object_t *p_this ) ...@@ -568,5 +562,4 @@ void __config_ResetAll( vlc_object_t *p_this )
} }
module_list_free (list); module_list_free (list);
vlc_mutex_unlock( &priv->config_lock );
} }
...@@ -152,16 +152,12 @@ static int strtoi (const char *str) ...@@ -152,16 +152,12 @@ static int strtoi (const char *str)
*****************************************************************************/ *****************************************************************************/
int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
{ {
libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
FILE *file; FILE *file;
file = config_OpenConfigFile (p_this, "rt"); file = config_OpenConfigFile (p_this, "rt");
if (file == NULL) if (file == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
/* Acquire config file lock */
vlc_mutex_lock( &priv->config_lock );
/* Look for the selected module, if NULL then save everything */ /* Look for the selected module, if NULL then save everything */
module_t **list = module_list_get (NULL); module_t **list = module_list_get (NULL);
...@@ -314,8 +310,6 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -314,8 +310,6 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
uselocale (baseloc); uselocale (baseloc);
freelocale (loc); freelocale (loc);
} }
vlc_mutex_unlock( &priv->config_lock );
return 0; return 0;
} }
...@@ -703,14 +697,12 @@ error: ...@@ -703,14 +697,12 @@ error:
int config_AutoSaveConfigFile( vlc_object_t *p_this ) int config_AutoSaveConfigFile( vlc_object_t *p_this )
{ {
libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
size_t i_index; size_t i_index;
bool save = false; bool save = false;
assert( p_this ); assert( p_this );
/* Check if there's anything to save */ /* Check if there's anything to save */
vlc_mutex_lock( &priv->config_lock );
module_t **list = module_list_get (NULL); module_t **list = module_list_get (NULL);
for( i_index = 0; list[i_index] && !save; i_index++ ) for( i_index = 0; list[i_index] && !save; i_index++ )
{ {
...@@ -729,7 +721,6 @@ int config_AutoSaveConfigFile( vlc_object_t *p_this ) ...@@ -729,7 +721,6 @@ int config_AutoSaveConfigFile( vlc_object_t *p_this )
} }
} }
module_list_free (list); module_list_free (list);
vlc_mutex_unlock( &priv->config_lock );
return save ? VLC_SUCCESS : SaveConfigFile( p_this, NULL, true ); return save ? VLC_SUCCESS : SaveConfigFile( p_this, NULL, true );
} }
......
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