Hi, Guilhem!
On Oct 14, Guilhem Bichot wrote:
>>> Maybe it is the deadlock which you feared on certain rwlock
>>> implementations? Note that Windows build is using our home-made
>>> thr_rwlock.c implementation.
>> Yes, looks like it's the one.
>
> So what should we do?
Try this one. It should make mysys/thr_rwlock.c to behave like
linux/solaris rwlocks do by default.
It's a workaround, not a real fix, of course.
=== modified file 'mysys/thr_rwlock.c'
--- mysys/thr_rwlock.c 2006-12-23 19:17:15 +0000
+++ mysys/thr_rwlock.c 2008-10-15 09:53:24 +0000
@@ -89,7 +89,7 @@
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 res;
pthread_mutex_lock(&rwp->lock);
- if ((rwp->state < 0 ) || rwp->waiters)
+ if (rwp->state < 0 )
res= EBUSY; /* Can't get lock */
else
{
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring