diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2003-03-04 20:30:30 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2003-03-04 20:30:30 +0000 |
| commit | 6b869595c510d2dcffd8d7f0a0eb4c9b3d0ce3e9 (patch) | |
| tree | bfadcba251e0434b249b1568c7be8a0e8f454a12 /sys/kern/kern_mutex.c | |
| parent | d7a715dc649078c721191aa6dc234dd6afd4d8a6 (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_mutex.c')
| -rw-r--r-- | sys/kern/kern_mutex.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 039621b72206..f5641c5584e9 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -464,19 +464,15 @@ _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); - if (rval) { - /* - * We do not handle recursion in _mtx_trylock; see the - * note at the top of the routine. - */ - KASSERT(!mtx_recursed(m), - ("mtx_trylock() called on a recursed mutex")); + if (rval) WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE | LOP_TRYLOCK, file, line); - } return (rval); } |
