Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Mar 2009 04:54:32 -0800 (PST)
From:      Barney Cordoba <barney_cordoba@yahoo.com>
To:        current@freebsd.org
Subject:   MTX Lock implementation question
Message-ID:  <142283.66010.qm@web63903.mail.re1.yahoo.com>

next in thread | raw e-mail | index | archive | help

Suppose the following:

Module foo.c

foo_getlock(sc)
{
   FOO_LOCK(sc);
}
foo_unlock(sc)
{
   FOO_UNLOCK(sc);
}
foo_dosomething(sc)
{
   MTX_LOCK_ASSERT(sc);
   foo_dooit();
}

Module bar.c

bar_dofoo()
{
   foo_getlock(sc);
   foo_dosomething(sc);
   foo_unlock(sc);
}


Is this something that shouldn't work? I need to access functions
 that require locks in a different module, but this code barfs on 
ASSERT with witness enabled. Is this a deflugalty in WITNESS, or do 
I need to create functions within foo that do the locking? Its been
working ok for awhile (its not a high volume function) but when I 
fired up witness to debug something else I encountered witness panics.

Thanks,

Barney


      



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?142283.66010.qm>