diff options
author | jhb <jhb@FreeBSD.org> | 2003-03-04 21:32:25 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-03-04 21:32:25 +0000 |
commit | 1ec02223897c43798625b70595c5897706ddaf52 (patch) | |
tree | 9e78abd003568a5f554962d6c4a4942c8600a14e /sys/kern/kern_mutex.c | |
parent | d943cf7d510a2b42fe3ea82d18118d8842e35214 (diff) | |
download | FreeBSD-src-1ec02223897c43798625b70595c5897706ddaf52.zip FreeBSD-src-1ec02223897c43798625b70595c5897706ddaf52.tar.gz |
Remove safety belt: it is now ok to do a mtx_trylock() on a mutex you
already own. The mtx_trylock() will fail however. Enhance the comment
at the top of the try lock function to explain this.
Requested by: jlemon and his evil netisr locking
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r-- | sys/kern/kern_mutex.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index d2d907f..9f59577 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -454,8 +454,10 @@ _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line) /* * The important part of mtx_trylock{,_flags}() - * Tries to acquire lock `m.' We do NOT handle recursion here; we assume that - * if we're called, it's because we know we don't already own this lock. + * Tries to acquire lock `m.' We do NOT handle recursion here. If this + * function is called on a recursed mutex, it will return failure and + * will not recursively acquire the lock. You are expected to know what + * you are doing. */ int _mtx_trylock(struct mtx *m, int opts, const char *file, int line) @@ -464,9 +466,6 @@ _mtx_trylock(struct mtx *m, int opts, const char *file, int line) MPASS(curthread != NULL); - KASSERT(!mtx_owned(m), - ("mtx_trylock() called on a mutex already owned")); - rval = _obtain_lock(m, curthread); LOCK_LOG_TRY("LOCK", &m->mtx_object, opts, rval, file, line); |