diff options
author | pjd <pjd@FreeBSD.org> | 2006-09-27 08:39:00 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-09-27 08:39:00 +0000 |
commit | e2d5d5e15d3d708b2c2f19bf74208bbedef93d03 (patch) | |
tree | 5da875b64050b3d3b2b1a7f7e210e51ccaa829be /share | |
parent | 88c514ae0ffa1dfb743b5626578c976dee659e20 (diff) | |
download | FreeBSD-src-e2d5d5e15d3d708b2c2f19bf74208bbedef93d03.zip FreeBSD-src-e2d5d5e15d3d708b2c2f19bf74208bbedef93d03.tar.gz |
- Use existing functions mtx_lock() and mtx_unlock().
- Change variable name to 'error', as this is what is mostly used for
functions that return an error.
- Add mutex(9) to the SEE ALSO section.
- Bump the date.
I don't really like the example code. I'd prefer symmetry where possible, eg.
mtx_lock(&example_lock);
error = example(NULL, EXAMPLE_ONE);
mtx_unlock(&example_lock);
if (error != 0)
return (error);
But I'll leave it as it is for now.
Reviewed by: simon
Diffstat (limited to 'share')
-rw-r--r-- | share/examples/mdoc/example.9 | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/share/examples/mdoc/example.9 b/share/examples/mdoc/example.9 index 7eb7088..0fb5a10 100644 --- a/share/examples/mdoc/example.9 +++ b/share/examples/mdoc/example.9 @@ -26,7 +26,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd January 12, 2005 +.Dd September 27, 2006 .Dt EXAMPLE 9 .Os .Sh NAME @@ -96,14 +96,14 @@ otherwise one of the values listed in the section is returned, to indicate the error. .Sh EXAMPLES .Bd -literal - int val; + int error; - mutex_lock(&example_lock); - if ((val = example(NULL, EXAMPLE_ONE)) != 0) { - mutex_unlock(&example_lock); - return (val); + mtx_lock(&example_lock); + if ((error = example(NULL, EXAMPLE_ONE)) != 0) { + mtx_unlock(&example_lock); + return (error); } - mutex_unlock(&example_lock); + mtx_unlock(&example_lock); .Ed .Sh COMPATIBILITY The @@ -298,7 +298,8 @@ Programming error. .Xr example 1 , .Xr example 3 , .Xr example 4 , -.Xr mdoc 7 +.Xr mdoc 7 , +.Xr mutex 9 .Rs .%A "A. B. Author" .%T "Example RFC Title" |