three locks and lock order reversal?
=?gb2312?q?popsong=20old?=
oldpopsong at yahoo.com
Wed Feb 4 18:30:01 PST 2004
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
More information about the freebsd-current
mailing list