On Mon, Dec 07, 2020 at 12:22:22PM -0800, Philip Guenther wrote:
> On Mon, Dec 7, 2020 at 11:16 AM Alexandr Nedvedicky <
> [email protected]> wrote:
>
> > What's the plan for rw_write_held()? Currently macro is true, if whoever
> > holds
> > the lock.
> >
> > >
> > > +#define rw_write_held(rwl) (rw_status(rwl) == RW_WRITE)
> >
>
> Nope. rw_status() returns RW_WRITE_OTHER if a different thread holds the
> lock.
>
>
may be I'm still missing something... the netbsd uses this implementation
of rw_write_held():
751 /*
752 * rw_write_held:
753 *
754 * Returns true if the rwlock is held for writing. Must only be
755 * used for diagnostic assertions, and never be used to make
756 * decisions about how to use a rwlock.
757 */
758 int
759 rw_write_held(krwlock_t *rw)
760 {
761
762 if (rw == NULL)
763 return 0;
764 return (rw->rw_owner & (RW_WRITE_LOCKED | RW_THREAD)) ==
765 (RW_WRITE_LOCKED | (uintptr_t)curlwp);
766 }
I'm just worried the test proposed by mpi@:
#define rw_write_held(rwl) (rw_status(rwl) == RW_WRITE)
Is not entirely compatible with stuff in NetBSD. perhaps I'm just confused.
thanks for clarification.
regards
sashan