Date: Wed, 4 Feb 2004 18:29:59 -0800 (PST) From: =?gb2312?q?popsong=20old?= <oldpopsong@yahoo.com> To: freebsd-current@freebsd.org Subject: three locks and lock order reversal? Message-ID: <20040205022959.94712.qmail@web60607.mail.yahoo.com>
next in thread | raw e-mail | index | archive | help
Hi, The test code below will result witness's warning of "lock order reversal": /* lock A then B */ mtx_lock(&A_mtx); mtx_lock(&B_mtx); mtx_unlock(&B_mtx); mtx_unlock(&A_mtx); /* lock B then C */ mtx_lock(&B_mtx); mtx_lock(&C_mtx); mtx_unlock(&C_mtx); mtx_unlock(&B_mtx); /* lock C then A, witness will complaint! */ mtx_lock(&C_mtx); mtx_lock(&A_mtx); mtx_unlock(&A_mtx); mtx_unlock(&C_mtx); But the code seems healthy and will not cause dead locking. So I guess that the lock order relationship should not be transferrable. Or am I missing something? song _________________________________________________________ Do You Yahoo!? 完全免费的雅虎电邮,马上注册获赠额外60兆网络存储空间 http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.mail.yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040205022959.94712.qmail>