1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Add rw_wowned() interface to rwlock(9), allowing a kernel thread to

determine if it holds an exclusive rwlock reference or not.  This is
non-ideal, but recursion scenarios in the network stack currently
require it.

Approved by:	jhb
This commit is contained in:
Robert Watson 2007-02-26 19:05:13 +00:00
parent 59800afcb5
commit 8525230afd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167024
2 changed files with 8 additions and 0 deletions

View File

@ -108,6 +108,13 @@ rw_sysinit(void *arg)
rw_init(args->ra_rw, args->ra_desc); rw_init(args->ra_rw, args->ra_desc);
} }
int
rw_wowned(struct rwlock *rw)
{
return (rw_wowner(rw) == curthread);
}
void void
_rw_wlock(struct rwlock *rw, const char *file, int line) _rw_wlock(struct rwlock *rw, const char *file, int line)
{ {

View File

@ -124,6 +124,7 @@
void rw_init(struct rwlock *rw, const char *name); void rw_init(struct rwlock *rw, const char *name);
void rw_destroy(struct rwlock *rw); void rw_destroy(struct rwlock *rw);
void rw_sysinit(void *arg); void rw_sysinit(void *arg);
int rw_wowned(struct rwlock *rw);
void _rw_wlock(struct rwlock *rw, const char *file, int line); void _rw_wlock(struct rwlock *rw, const char *file, int line);
void _rw_wunlock(struct rwlock *rw, const char *file, int line); void _rw_wunlock(struct rwlock *rw, const char *file, int line);
void _rw_rlock(struct rwlock *rw, const char *file, int line); void _rw_rlock(struct rwlock *rw, const char *file, int line);