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:[EMAIL PROTECTED] >> Sent: Thursday, June 12, 2003 4:30 PM >> To: [email protected] >> 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! | | [EMAIL PROTECTED] | He's a very naughty boy!" - Life of Brian | ------------------------------------------------------------------------------
