Allow assert that the current thread does not hold the sx(9) lock.

Reviewed by:		jhb
In cooperation with:	juli, jhb
Approved by:		jhb, scottl (mentor)
This commit is contained in:
Pawel Jakub Dawidek 2004-02-04 08:14:58 +00:00
parent 2ccbe4b596
commit 19b0efd32d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125421

View File

@ -344,6 +344,17 @@ _sx_assert(struct sx *sx, int what, const char *file, int line)
sx->sx_object.lo_name, file, line);
mtx_unlock(sx->sx_lock);
break;
case SX_UNLOCKED:
#ifdef WITNESS
witness_assert(&sx->sx_object, what, file, line);
#else
mtx_lock(sx->sx_lock);
if (sx->sx_cnt != 0 && sx->sx_xholder == curthread)
printf("Lock %s locked @ %s:%d\n",
sx->sx_object.lo_name, file, line);
mtx_unlock(sx->sx_lock);
#endif
break;
default:
panic("Unknown sx lock assertion: %d @ %s:%d", what, file,
line);