From fbf13eb8d6902285738f0534b7825c6357ed0646 Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Thu, 10 Jul 2003 14:14:40 +0000 Subject: when two concurrent threads want to create the same config entry, both might run the lookup simultaneously and so both might find the entry missing; as a result, the entry might be created twice afterwards -> fixed by moving the mutex to protect the lookup as well CVS patchset: 5139 CVS date: 2003/07/10 14:14:40 --- src/xine-engine/configfile.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 9db15c94c..3e67df3d3 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.47 2003/03/25 12:49:15 mroi Exp $ + * $Id: configfile.c,v 1.48 2003/07/10 14:14:40 mroi Exp $ * * config object (was: file) management - implementation * @@ -221,10 +221,10 @@ static char *_xine_config_register_string (config_values_t *this, #endif /* make sure this entry exists, create it if not */ + pthread_mutex_lock(&this->config_lock); entry = _xine_config_lookup_entry (this, key); - pthread_mutex_lock(&this->config_lock); if (!entry) { entry = xine_config_add (this, key); entry->unknown_value = copy_string(def_value); @@ -285,10 +285,10 @@ static int _xine_config_register_num (config_values_t *this, #endif /* make sure this entry exists, create it if not */ + pthread_mutex_lock(&this->config_lock); entry = _xine_config_lookup_entry (this, key); - pthread_mutex_lock(&this->config_lock); if (!entry) { entry = xine_config_add (this, key); entry->unknown_value = NULL; @@ -343,10 +343,10 @@ static int _xine_config_register_bool (config_values_t *this, #endif /* make sure this entry exists, create it if not */ + pthread_mutex_lock(&this->config_lock); entry = _xine_config_lookup_entry (this, key); - pthread_mutex_lock(&this->config_lock); if (!entry) { entry = xine_config_add (this, key); entry->unknown_value = NULL; @@ -402,10 +402,10 @@ static int _xine_config_register_range (config_values_t *this, #endif /* make sure this entry exists, create it if not */ + pthread_mutex_lock(&this->config_lock); entry = _xine_config_lookup_entry (this, key); - pthread_mutex_lock(&this->config_lock); if (!entry) { entry = xine_config_add (this, key); entry->unknown_value = NULL; @@ -494,10 +494,10 @@ static int _xine_config_register_enum (config_values_t *this, #endif /* make sure this entry exists, create it if not */ + pthread_mutex_lock(&this->config_lock); entry = _xine_config_lookup_entry (this, key); - pthread_mutex_lock(&this->config_lock); if (!entry) { entry = xine_config_add (this, key); entry->unknown_value = NULL; -- cgit v1.2.3