Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/man/man9 Cleanups and standardization.
details: https://anonhg.NetBSD.org/src/rev/70074c04376e
branches: trunk
changeset: 353726:70074c04376e
user: wiz <wiz%NetBSD.org@localhost>
date: Fri May 19 10:38:21 2017 +0000
description:
Cleanups and standardization.
diffstat:
share/man/man9/localcount.9 | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diffs (101 lines):
diff -r a366df9f6efd -r 70074c04376e share/man/man9/localcount.9
--- a/share/man/man9/localcount.9 Fri May 19 09:58:28 2017 +0000
+++ b/share/man/man9/localcount.9 Fri May 19 10:38:21 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: localcount.9,v 1.3 2017/05/19 01:54:50 pgoyette Exp $
+.\" $NetBSD: localcount.9,v 1.4 2017/05/19 10:38:21 wiz Exp $
.\"
.\" Copyright (c) 2016
.\" All rights reserved.
@@ -37,6 +37,7 @@
.Nm localcount_acquire ,
.Nm localcount_release ,
.Nm localcount_drain
+.Nd reference-count primitives
.Sh SYNOPSIS
.In sys/localcount.h
.Ft int
@@ -85,9 +86,8 @@
such as xyzread for a device xyz(4), and short-term fast operations, such as
.Dv xyzioctl(IOC_READ_A_CPU_REG) .
.Sh FUNCTIONS
-.Bl -tag -width abcd
+.Bl -tag -width 32n
.It Fn localcount_init "lc"
-.Pp
Dynamically initialize localcount
.Ar lc
for use.
@@ -95,7 +95,6 @@
No other operations can be performed on a localcount until it has been
initialized.
.It Fn localcount_fini "lc"
-.Pp
Release resources used by localcount
.Ar lc .
The caller must have already called
@@ -105,30 +104,28 @@
has been called until it has been re-initialized by
.Fn localcount_init .
.It Fn localcount_acquire "lc"
-.Pp
Acquire a reference to the localcount
.Ar lc .
.It Fn localcount_release "lc" "cv" "mtx"
-.Pp
Release a reference to the localcount
.Ar lc .
If the localcount is currently being drained, the mutex
.Ar mtx
-will be used to synchronize updates to the global reference count (i.e.
+will be used to synchronize updates to the global reference count (i.e.,
the total across all CPUs).
If the reference count goes to zero,
.Fn localcount_release
will broadcast availability of the condvar
.Ar cv .
.It Fn localcount_drain "lc" "cv" "mtx"
-.Pp
Wait for all references to the localcount
.Ar lc
to be released.
The caller must hold the mutex
.Ar mtx ;
the mutex will be released during inter-CPU cross-calls (see
-.Xr xcall 9 ) and while waiting on the condvar
+.Xr xcall 9 )
+and while waiting on the condvar
.Ar cv .
The same
.Ar cv
@@ -138,7 +135,8 @@
.Fn localcount_release .
.Pp
The caller must guarantee that no new references can be acquired with
-localcount_acquire before calling
+.Fn localcount_acquire
+before calling
.Fn localcount_drain .
For example, any object that may be found in a list and acquired must be
removed from the list before calling
@@ -150,6 +148,7 @@
it must be passed to
.Fn localcount_fini
before any other re-use.
+.El
.Sh CODE REFERENCES
The core of the localcount implementation is located in
.Pa sys/kern/subr_localcount.c .
@@ -162,7 +161,6 @@
.Xr atomic_ops 3 ,
.Xr condvar 9 ,
.Xr mutex 9 ,
-and
.Xr psref 9
.Sh HISTORY
The localcount primitives first appeared in
@@ -189,4 +187,3 @@
has been drained, no further operations are allowed until the
.Nm
has been re-initialized.
-
Home |
Main Index |
Thread Index |
Old Index