diff options
author | darrenr <darrenr@FreeBSD.org> | 2004-07-11 16:08:25 +0000 |
---|---|---|
committer | darrenr <darrenr@FreeBSD.org> | 2004-07-11 16:08:25 +0000 |
commit | 6c66c4291a6c529dc538151fb896c0295231e2ef (patch) | |
tree | 902bd96e565263878e39afc230b7f038a243f6c2 /share | |
parent | 210d568a00115cf67bdb5a1f5cf391778b4e5493 (diff) | |
download | FreeBSD-src-6c66c4291a6c529dc538151fb896c0295231e2ef.zip FreeBSD-src-6c66c4291a6c529dc538151fb896c0295231e2ef.tar.gz |
Document that sx_unlock() exists as a macro.
Remove redundant include file, <sys/kernel.h>, and clean up the function
list at the top with the addition of a "Sx utility macro" section.
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/sx.9 | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/share/man/man9/sx.9 b/share/man/man9/sx.9 index c07dc9d..17ab206 100644 --- a/share/man/man9/sx.9 +++ b/share/man/man9/sx.9 @@ -42,6 +42,7 @@ .Nm sx_try_upgrade , .Nm sx_downgrade , .Nm sx_assert , +.Nm sx_unlock , .Nm SX_SYSINIT .Nd kernel shared/exclusive lock .Sh SYNOPSIS @@ -68,13 +69,16 @@ .Fn sx_try_upgrade "struct sx *sx" .Ft void .Fn sx_downgrade "struct sx *sx" -.Pp -.Cd "options INVARIANTS" -.Cd "options INVARIANT_SUPPORT" .Ft void .Fn sx_assert "struct sx *sx" "int what" -.In sys/kernel.h +.\" +.Ss sx utility macros +.Fn sx_unlock "struct sx *sx" .Fn SX_SYSINIT "name" "struct sx *sx" "const char *description" +.\" +.Ss Kernel options +.Cd "options INVARIANTS" +.Cd "options INVARIANT_SUPPORT" .Sh DESCRIPTION Shared/exclusive locks are used to protect data that are read far more often than they are written. @@ -98,13 +102,17 @@ Threads acquire and release a shared lock by calling or .Fn sx_try_slock and -.Fn sx_sunlock . +.Fn sx_sunlock +or +.Fn sx_unlock . Threads acquire and release an exclusive lock by calling .Fn sx_xlock or .Fn sx_try_xlock and -.Fn sx_xunlock . +.Fn sx_xunlock +or +.Fn sx_unlock . A thread can attempt to upgrade a currently held shared lock to an exclusive lock by calling .Fn sx_try_upgrade . @@ -158,6 +166,15 @@ lock pointed to by the first argument. .El .Pp +For ease of programming, +.Fn sx_unlock +is provided as a macro frontend to the respective functions, +.Fn sx_sunlock +and +.Fn sx_xunlock . +Algorithms that are aware of what state the lock is in should use either +of the two specific functions for a minor performance benefit. +.Pp The .Fn SX_SYSINIT macro is used to generate a call to the |