From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <90fc526d76991a36a045593f14155a90@davidashen.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] qunlock Date: Thu, 24 Jun 2004 01:11:54 +0500 From: dvd@davidashen.net In-Reply-To: <29dbd0842758b89af800a214a30c9fac@vitanuova.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: ab34f0fe-eacd-11e9-9e20-41e7f4b1d025 > > calling qunlock on an unlocked QLock is no-op, isn't it? > > i'd have thought it best to regard it as best avoided. > does it happen, or was it something you wanted to do? > I need to release a qlock in a criticial session guarded by another lock, QLock p,q; void x() { qlock(&p); if(...) qunlock(&q); qunlock(&p); } void y() { qlock(&q); qlock(&p); qunlock(&p); } The question is whether the above is legal or should I write if(...){ canqlock(&q); qunlock(&q); } instead?