mirror of
https://github.com/MariaDB/server.git
synced 2025-08-16 18:19:41 +00:00
fixes for hanging waiting_thread-t.c on windows
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
This commit is contained in:
@ -126,7 +126,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
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
|
||||
|
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user