Commit 5662f3a4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Small simplification

parent f7324726
...@@ -339,6 +339,7 @@ void vlc_rwlock_wrlock (vlc_rwlock_t *lock) ...@@ -339,6 +339,7 @@ void vlc_rwlock_wrlock (vlc_rwlock_t *lock)
lock->writers++; lock->writers++;
while ((lock->readers > 0) || (lock->writer != 0)) while ((lock->readers > 0) || (lock->writer != 0))
vlc_cond_wait (&lock->write_wait, &lock->mutex); vlc_cond_wait (&lock->write_wait, &lock->mutex);
lock->writers--;
lock->writer = GetCurrentThreadId (); lock->writer = GetCurrentThreadId ();
vlc_mutex_unlock (&lock->mutex); vlc_mutex_unlock (&lock->mutex);
} }
...@@ -352,11 +353,7 @@ void vlc_rwlock_unlock (vlc_rwlock_t *lock) ...@@ -352,11 +353,7 @@ void vlc_rwlock_unlock (vlc_rwlock_t *lock)
if (lock->readers > 0) if (lock->readers > 0)
lock->readers--; /* Read unlock */ lock->readers--; /* Read unlock */
else else
{
lock->writer = 0; /* Write unlock */ lock->writer = 0; /* Write unlock */
assert (lock->writers > 0);
lock->writers--;
}
if (lock->writers > 0) if (lock->writers > 0)
{ {
......
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