apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <bri...@kheldar.apana.org.au>
Subject RE: read/write lockout
Date Sun, 15 Jun 2003 23:24:18 GMT
On Sun, 15 Jun 2003 12:08:55 -0700, Marc M. Adkins wrote:

>I have code that uses a rwlock, a mutex, a condition, and an atomic variable
>to provide something approaching fairness (on W2K, I haven't gotten around
>to testing this on Linux yet).  I can post it if anyone is interested.

The OS/2 implementation (locks/os2/thread_rwlock.c) I wrote also avoids
writer starvation in that it won't allow any new reader locks while a
writer is waiting. It uses 1 mutex, 1 event semaphore. It should translate
to Win32 quite easily. If you can spot any holes in my logic, please let me
know :)

>> -----Original Message-----
>> From: Marc M. Adkins [mailto:mmadki@Doorways.org]
>> Sent: Thursday, June 12, 2003 4:30 PM
>> To: dev@apr.apache.org
>> Subject: read/write lockout
>> On W2K, read/write locks can result in writer starvation.  If there are a
>> lot of readers a writer may never get a chance to lock at all.  
>> I'm assuming
>> that 'fairness' in this sense is simply not guaranteed by APR.  I was
>> wondering if anyone else had run up against this and how they solved it.

 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |

View raw message