Add rm_wowned(9) function to test whether the current thread owns an

exclusive lock on the passed rmlock.

Reviewed by:	ups
This commit is contained in:
Robert Watson 2007-11-10 15:06:30 +00:00
parent 01ea2a8822
commit 433ea89af4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173520
3 changed files with 16 additions and 2 deletions

View File

@ -26,8 +26,7 @@
.\" $FreeBSD$
.\"
.\" Based on rwlock.9 man page
.Dd August 22, 2007
.Dd November 10, 2007
.Dt RMLOCK 9
.Os
.Sh NAME
@ -38,6 +37,7 @@
.Nm rm_wlock ,
.Nm rm_runlock ,
.Nm rm_wunlock ,
.Nm rm_wowned ,
.Nm RM_SYSINIT
.Nd mostly read lock - a kernel reader/writer lock optimized for mostly read access patterns
.Sh SYNOPSIS
@ -56,6 +56,8 @@
.Fn rm_runlock "struct rmlock *rm" "struct rm_priotracker* tracker"
.Ft void
.Fn rm_wunlock "struct rmlock *rm"
.Ft int
.Fn rm_wowned "struct rmlock *rm"
.In sys/kernel.h
.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" "int opts"
.Sh DESCRIPTION
@ -162,6 +164,10 @@ This functions destroys a lock previously initialized with
The
.Fa rm
lock must be unlocked.
.It Fn rm_wowned "struct rmlock *rm"
This function returns a non-zero value if the current thread owns an
exclusive lock on
.Fa rm .
.El
.El
.Sh SEE ALSO

View File

@ -175,6 +175,13 @@ rm_destroy(struct rmlock *rm)
lock_destroy(&rm->lock_object);
}
int
rm_wowned(struct rmlock *rm)
{
return (mtx_owned(&rm->rm_lock));
}
void
rm_sysinit(void *arg)
{

View File

@ -42,6 +42,7 @@
void rm_init(struct rmlock *rm, const char *name, int opts);
void rm_destroy(struct rmlock *rm);
int rm_wowned(struct rmlock *rm);
void rm_sysinit(void *arg);