diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2005-01-15 16:01:19 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2005-01-15 16:01:19 +0000 |
commit | e2a9113a2bc2f9d6ae67db7729041b1d81a1cc0c (patch) | |
tree | 4710161820b3733f67e3b0903d69f8705534ea1a /share/examples/mdoc/example.9 | |
parent | 6f0bb997408739adc68911272ebb5584a6ed249d (diff) | |
download | FreeBSD-src-e2a9113a2bc2f9d6ae67db7729041b1d81a1cc0c.zip FreeBSD-src-e2a9113a2bc2f9d6ae67db7729041b1d81a1cc0c.tar.gz |
Move the LOCKING section to before the EXAMPLES section.
Make example locking calls in the EXAMPLES section.
Reviewed by: keramida
Diffstat (limited to 'share/examples/mdoc/example.9')
-rw-r--r-- | share/examples/mdoc/example.9 | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/share/examples/mdoc/example.9 b/share/examples/mdoc/example.9 index f40e330..7eb7088 100644 --- a/share/examples/mdoc/example.9 +++ b/share/examples/mdoc/example.9 @@ -33,11 +33,11 @@ .Nm example .Nd "example kernel interface manual page" .Sh SYNOPSIS -.In example.h +.In sys/example.h .Ft int .Fn example "char *ptr" "int mode" .Sh DESCRIPTION -This is an example library function manual page for the +This is an example manual page for the .Fn example kernel function. It is intended that this example can be used as a template @@ -72,6 +72,21 @@ as follows: The .Fn example function is not actually implemented. +.Sh LOCKING +The +.Va example_lock +lock must be held before +.Fn example +is called. +.Pp +Since +.Va example_lock +is a +.Xr mutex 9 , +no sleepable locks (i.e., +.Xr sx 9 +locks) can be acquired in +.Fn example . .Sh RETURN VALUES The .Fn example @@ -83,8 +98,12 @@ section is returned, to indicate the error. .Bd -literal int val; - if ((val = example(NULL, EXAMPLE_ONE)) != 0) + mutex_lock(&example_lock); + if ((val = example(NULL, EXAMPLE_ONE)) != 0) { + mutex_unlock(&example_lock); return (val); + } + mutex_unlock(&example_lock); .Ed .Sh COMPATIBILITY The @@ -275,21 +294,6 @@ Attribute not found. .It Bq Er EDOOFUS Programming error. .El -.Sh LOCKING -The -.Va example_lock -lock must be held before -.Fn example -is called. -.Pp -Since -.Va example_lock -is a -.Xr mutex 9 , -no sleepable locks (i.e., -.Xr sx 9 -locks) can be acquired in -.Fn example . .Sh SEE ALSO .Xr example 1 , .Xr example 3 , |