Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Nov 2008 13:42:36 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        huntting@glarp.com
Cc:        freebsd-drivers@FreeBSD.org
Subject:   Re: mutex quandry 
Message-ID:  <20081124.134236.723203643.imp@bsdimp.com>
In-Reply-To: <200811241911.mAOJBVkM067002@antediluvian.glarp.com>
References:  <20081124.103816.1649771647.imp@bsdimp.com> <200811241911.mAOJBVkM067002@antediluvian.glarp.com>

index | next in thread | previous in thread | raw e-mail

In message: <200811241911.mAOJBVkM067002@antediluvian.glarp.com>
            Brad Huntting <huntting@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


home | help

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