Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 78511 Build 75394: arc lint + arc unit
Event Timeline
Why did you left trywrlock() out of this change? POSIX allows both wrlock() and trywrlock() to return EDEADLK, and our man page notes the error for both functions. So if making one return the error, I do not see why not making another to behave identically.
I add the same thing on read sides and I think drop WRITE flag check is fine in here.
| lib/libthr/thread/thr_rwlock.c | ||
|---|---|---|
| 180 | It is a bit nicer to check this after the initial trylock fails, so you don't have to pay for the check if the lock is uncontended. I would also add __predict_false() annotations. | |
| lib/libthr/thread/thr_rwlock.c | ||
|---|---|---|
| 208 | I do not understand this. You are handling read locking, there could be more than one owner, and we do not track owners for rdlock. | |
| lib/libthr/thread/thr_rwlock.c | ||
|---|---|---|
| 208 | Presumably the lock acquisition failed because a writer is holding the lock already. But in that case we will return EBUSY, so what's the point of converting it to EDEADLK? According to https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/pthread_rwlock_rdlock.html EDEADLK should be returned only by pthread_rwlock_rdlock(). | |