Marc M. Adkins wrote:
>I've re-coded the Windows rwlock based on the OS/2 algorithm implemented by
>Brian Havard. My test program doesn't show starvation with this algorithm.
>I'm assuming that the code is stable and works correctly on OS/2, and it's
>essentially the same code here, plus it passes all the tests I know how to
>do so I'm submitting the code for review.
>
>Somewhat to my surprise the performance test program that comes with APR
>seems to show an increase in speed of 30% - 50%. Possibly because the old
>code had two mutex waits for a read lock and the new code has one.
>
>I was initially surprised because the new code has tests on return values
>and an extra level of subroutine calling not present in the old code. Not
>to mention additional functionality: tryrdlock and trywrlock are both
>working now and starvation should be prevented. When does more
>functionality ever mean faster?
>
>I'm attaching the two changed files, which were essentially rewritten. So
>far as I can tell, the 2.1 code is still the same in CVS, so just replacing
>the files in their entirety should be sufficient. I can do diffs if that is
>better. I don't personally have CVS write access.
>
>mma
>
>
This definitely looks better based on the part I have reviewed. It
doesn't appear to me that the old code will ever allow multiple readers.
+1 with some coding style cleanups (which I'll do if I commit this code
tomorrow).
Bill
|