[Date Prev][Date Next]
rdwr code looks wrong to me (ITS#395)
Full_Name: Ty Sarna
OS: IRIX 6.5
Submission from: (NULL) (22.214.171.124)
Hi. I was adding some new code to 1.2.7 which used rdwr locks, and noticed some
strange behavior. When I tracked down the problems withmy new code, I
that it seemed to be getting a reader lock while a writer lock was held.
So I looked at rdwr.c, and the logic seems... wrong. Perhaps I'm
but shouldn't the tests for "rw->ltrw_w_active > 1" be "> 0"? There should never
more than one writer active anyway. This change seems to have been made when the
implementation was replaced with one from a different textbook. Based on the
every 1.2 and later version has this change.
When I changed these tests to look the way I think they should, my code started
working as expected.
If I'm right about this being incorrect, I wonder what else is losing as a