Add refcnt_shared() and refcnt_read()
authorvisa <visa@openbsd.org>
Wed, 16 Mar 2022 14:13:01 +0000 (14:13 +0000)
committervisa <visa@openbsd.org>
Wed, 16 Mar 2022 14:13:01 +0000 (14:13 +0000)
commit220c85f6f87b15ccf7313fbf086e4d1edf1515e1
tree883ec958d5634f25d7bef55f683452eaf01b499b
parentda7718e0f826bbbd1dbe3c4a32598b0fec2b4517
Add refcnt_shared() and refcnt_read()

refcnt_shared() checks whether the object has multiple references.
When refcnt_shared() returns zero, the caller is the only reference
holder.

refcnt_read() returns a snapshot of the counter value.

refcnt_shared() suggested by dlg@.

OK dlg@ mvs@
share/man/man9/refcnt_init.9
sys/kern/kern_synch.c
sys/sys/refcnt.h