Skip to content
Snippets Groups Projects
Commit fd2a9dfd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

config: remove recursive lock on auto-save

This was only there to handle the dirty flag atomically with the actual
saving of the configuration file.
parent b282e134
No related branches found
No related tags found
1 merge request!946config: lock-less int/float reads
......@@ -530,25 +530,20 @@ error:
int config_AutoSaveConfigFile( vlc_object_t *p_this )
{
int ret = 0;
assert( p_this );
if (atomic_exchange_explicit(&config_dirty, false, memory_order_acquire))
{
vlc_rwlock_rdlock (&config_lock);
/* Note: this will get the read lock recursively. Ok. */
ret = config_SaveConfigFile (p_this);
vlc_rwlock_unlock (&config_lock);
if (!atomic_exchange_explicit(&config_dirty, false, memory_order_acquire))
return 0;
if (unlikely(ret != 0))
/*
* On write failure, set the dirty flag back again. While it looks
* racy, it really means to retry later in hope that it does not
* fail again. Concurrent write attempts would not succeed anyway.
*/
atomic_store_explicit(&config_dirty, true, memory_order_relaxed);
}
int ret = config_SaveConfigFile (p_this);
if (unlikely(ret != 0))
/*
* On write failure, set the dirty flag back again. While it looks
* racy, it really means to retry later in hope that it does not
* fail again. Concurrent write attempts would not succeed anyway.
*/
atomic_store_explicit(&config_dirty, true, memory_order_relaxed);
return ret;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment