[vlc-devel] commit: Do not blindly favor writers ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Jul 6 22:51:23 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul  6 23:50:03 2009 +0300| [88e839df430ea2f677356d59db6884586978699c] | committer: Rémi Denis-Courmont 

Do not blindly favor writers

This fixes a corner case:
A: rdlock -> OK
B: wrlock -> sleeps
A: rdlock -> dead lock

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88e839df430ea2f677356d59db6884586978699c
---

 src/misc/w32thread.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/misc/w32thread.c b/src/misc/w32thread.c
index a696dd1..1398159 100644
--- a/src/misc/w32thread.c
+++ b/src/misc/w32thread.c
@@ -320,7 +320,7 @@ void vlc_rwlock_destroy (vlc_rwlock_t *lock)
 void vlc_rwlock_rdlock (vlc_rwlock_t *lock)
 {
     vlc_mutex_lock (&lock->mutex);
-    while (lock->writers > 0) /* Favor writers to avoid starving */
+    while (lock->writer != 0)
         vlc_cond_wait (&lock->read_wait, &lock->mutex);
     if (lock->readers == ULONG_MAX)
         abort ();




More information about the vlc-devel mailing list