summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-07-10 14:14:40 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-07-10 14:14:40 +0000
commitfbf13eb8d6902285738f0534b7825c6357ed0646 (patch)
treec5ed478e5706fdaf7c69b1ff0d194ac8d320376d
parenta52a8c21084dbdd781df7b503202992c53e10fd0 (diff)
downloadxine-lib-fbf13eb8d6902285738f0534b7825c6357ed0646.tar.gz
xine-lib-fbf13eb8d6902285738f0534b7825c6357ed0646.tar.bz2
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
-rw-r--r--src/xine-engine/configfile.c12
1 files changed, 6 insertions, 6 deletions
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;