#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/
2684 Sergei Golubchik 2008-10-21
fixes for hanging waiting_thread-t.c on windows
modified:
mysys/my_wincond.c
mysys/thr_rwlock.c
per-file messages:
mysys/my_wincond.c
race condition: block gate could be left open forever, if cond_broadcast
was done right after the last thread left WaitForMultipleObjects() on timeout
mysys/thr_rwlock.c
make rwlocks behave similar to their distant linux/solaris relatives
=== modified file 'mysys/my_wincond.c'
--- a/mysys/my_wincond.c 2007-05-10 09:59:39 +0000
+++ b/mysys/my_wincond.c 2008-10-21 14:10:04 +0000
@@ -126,7 +126,7 @@ int pthread_cond_timedwait(pthread_cond_
EnterCriticalSection(&cond->lock_waiting);
cond->waiting--;
- if (cond->waiting == 0 && result == (WAIT_OBJECT_0+BROADCAST))
+ if (cond->waiting == 0)
{
/*
We're the last waiter to be notified or to stop waiting, so
=== modified file 'mysys/thr_rwlock.c'
--- a/mysys/thr_rwlock.c 2006-12-23 19:17:15 +0000
+++ b/mysys/thr_rwlock.c 2008-10-21 14:10:04 +0000
@@ -89,7 +89,7 @@ int my_rw_rdlock(rw_lock_t *rwp)
pthread_mutex_lock(&rwp->lock);
/* active or queued writers */
- while (( rwp->state < 0 ) || rwp->waiters)
+ while (( rwp->state < 0 ))
pthread_cond_wait( &rwp->readers, &rwp->lock);
rwp->state++;
@@ -101,7 +101,7 @@ int my_rw_tryrdlock(rw_lock_t *rwp)
{
int res;
pthread_mutex_lock(&rwp->lock);
- if ((rwp->state < 0 ) || rwp->waiters)
+ if ((rwp->state < 0 ))
res= EBUSY; /* Can't get lock */
else
{
| Thread |
|---|
| • bzr commit into MySQL/Maria:mysql-maria branch (serg:2684) | Sergei Golubchik | 21 Oct |