Document sx_xholder().

This commit is contained in:
John Baldwin 2007-05-19 20:24:32 +00:00
parent 71a95881d4
commit 2b9573af36
2 changed files with 13 additions and 0 deletions

View File

@ -1068,6 +1068,7 @@ MLINKS+=sx.9 sx_assert.9 \
sx.9 sx_try_xlock.9 \
sx.9 sx_sleep.9 \
sx.9 sx_unlock.9 \
sx.9 sx_xholder.9 \
sx.9 sx_xlock.9 \
sx.9 sx_xlocked.9 \
sx.9 sx_xunlock.9

View File

@ -44,6 +44,7 @@
.Nm sx_try_upgrade ,
.Nm sx_downgrade ,
.Nm sx_sleep ,
.Nm sx_xholder ,
.Nm sx_xlocked ,
.Nm sx_assert ,
.Nm SX_SYSINIT
@ -78,6 +79,8 @@
.Fn sx_downgrade "struct sx *sx"
.Ft int
.Fn sx_sleep "void *chan" "struct sx *sx" "int priority" "const char *wmesg" "int timo"
.Ft "struct thread *"
.Fn sx_xholder "struct sx *sx"
.Ft int
.Fn sx_xlocked "struct sx *sx"
.Pp
@ -235,6 +238,15 @@ Assert that the current thread does not have a recursed lock on
.Fa sx .
.El
.Pp
.Fn sx_xholder
will return a pointer to the thread which currently holds an exclusive lock on
.Fa sx .
If no thread holds an exclusive lock on
.Fa sx ,
then
.Dv NULL
is returned instead.
.Pp
.Fn sx_xlocked
will return non-zero if the current thread holds the exclusive lock;
otherwise, it will return zero.