refcount_release_take_##lock
Mateusz Guzik
mjguzik at gmail.com
Tue Oct 28 19:34:10 UTC 2014
On Tue, Oct 28, 2014 at 02:13:58PM -0400, John Baldwin wrote:
> On Tuesday, October 28, 2014 1:44:28 pm Mateusz Guzik wrote:
> > diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
> > index f8ae0e6..e94ccde 100644
> > --- a/sys/kern/kern_jail.c
> > +++ b/sys/kern/kern_jail.c
>
> The diff looks good to me. Just need to update refcount.9 as well.
>
diff --git a/share/man/man9/refcount.9 b/share/man/man9/refcount.9
index e7702a2..61b9b51 100644
--- a/share/man/man9/refcount.9
+++ b/share/man/man9/refcount.9
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 20, 2009
+.Dd October 28, 2014
.Dt REFCOUNT 9
.Os
.Sh NAME
@@ -44,6 +44,15 @@
.Fn refcount_acquire "volatile u_int *count"
.Ft int
.Fn refcount_release "volatile u_int *count"
+.In sys/mutex.h
+.Fn refcount_release_lock_mtx "volatile u_int *count, struct mtx *lock"
+.In sys/rmlock.h
+.Fn refcount_release_lock_rmlock "volatile u_int *count, struct rmlock *lock"
+.In sys/rwlock.h
+.Fn refcount_release_lock_rwlock "volatile u_int *count, struct rwlock *lock"
+.In sys/lock.h
+.In sys/sx.h
+.Fn refcount_release_lock_sx "volatile u_int *count, struct sx *lock"
.Sh DESCRIPTION
The
.Nm
@@ -77,6 +86,13 @@ The function returns a non-zero value if the reference being released was
the last reference;
otherwise, it returns zero.
.Pp
+.Fn refcount_release_lock_*
+functions release an existing reference holding the lock if it is the last
+reference.
+These functions return with the lock held and a non-zero value if the reference
+being released was the last reference;
+otherwise, they returns zero and the lock is not held.
+.Pp
Note that these routines do not provide any inter-CPU synchronization,
data protection,
or memory ordering guarantees except for managing the counter.
@@ -91,6 +107,18 @@ The
.Nm refcount_release
function returns non-zero when releasing the last reference and zero when
releasing any other reference.
+.Pp
+.Nm refcount_release_lock_*
+functions return with the lock held and non-zero value when releasing the last
+reference, zero without the lock held when releasing any other reference.
.Sh HISTORY
-These functions were introduced in
+.Fn refcount_init ,
+.Fn refcount_acquire
+and
+.Fn refcount_release
+functions were introduced in
.Fx 6.0 .
+.Pp
+.Fn refcount_release_lock_*
+functions were introduced in
+.Fx 10.2 .
--
Mateusz Guzik <mjguzik gmail.com>
More information about the freebsd-arch
mailing list