tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rw_lock_held

> Date: Tue, 6 Feb 2018 19:06:33 +0900
> From: Ryota Ozaki <>
> Is there any reason that rw_lock_held checks if it's held
> by *someone*, not by curlwp? It's confusable and most (or all?)
> users of the API seem to expect the latter (held by curlwp).

Wild guesses:

(a) because it seemed fast to just test (owner & RW_THREAD) != 0, or
(b) because Solaris did it.

> So I think we should do either:
> (1) fix rw_lock_held, or
>     - probably it would be rw_read_held() || rw_write_held()
> (2) fix users of rw_lock_held.
>     - it also would replace rw_lock_held with
>       rw_read_held() || rw_write_held()
> I prefer (1) because I think there is no user of the current
> behavior that is difficult to use for users (it may be useful
> as an internal utility function though).

I like (1) too, but check for Solaris compatibility?  It is hard to
imagine that there are correct uses of the current semantics that are
not also correct uses of (1).

Home | Main Index | Thread Index | Old Index