From 9162bf224ccd6379570f9292c0a8c8f56e47483a Mon Sep 17 00:00:00 2001 From: rwatson Date: Sat, 10 Nov 2007 15:06:30 +0000 Subject: Add rm_wowned(9) function to test whether the current thread owns an exclusive lock on the passed rmlock. Reviewed by: ups --- sys/kern/kern_rmlock.c | 7 +++++++ sys/sys/rmlock.h | 1 + 2 files changed, 8 insertions(+) (limited to 'sys') diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 5a91811..276aee6 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -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) { diff --git a/sys/sys/rmlock.h b/sys/sys/rmlock.h index 04ccb38..ab0b566 100644 --- a/sys/sys/rmlock.h +++ b/sys/sys/rmlock.h @@ -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); -- cgit v1.1