tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: rw_lock_held
On Wed, Feb 7, 2018 at 2:55 AM, Taylor R Campbell
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
>> Date: Tue, 6 Feb 2018 19:06:33 +0900
>> From: Ryota Ozaki <ozaki-r%netbsd.org@localhost>
>>
>> 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).
https://docs.oracle.com/cd/E36784_01/html/E36886/rwlock-9f.html
They seem to have only rw_read_locked that is compatible to our
rw_read_held.
ozaki-r
Home |
Main Index |
Thread Index |
Old Index