mutex quandry

M. Warner Losh imp at bsdimp.com
Mon Nov 24 12:42:04 PST 2008


In message: <200811241911.mAOJBVkM067002 at antediluvian.glarp.com>
            Brad Huntting <huntting at glarp.com> writes:
: The combination of checking sc_running and incrementing sc_inuse
: needs to be atomic (hence a mutex around them) but at some point
: detach() has to destroy the mutex but my code may still need to use
: it.

Your solution to this is to make sure that never happens.  Anything
else is really racy.  If you are destroying your mutex and allowing
detach to return, the entire sc is freed, so you're dead from that
anyway...

Warner


More information about the freebsd-drivers mailing list