From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] qunlock Date: Thu, 24 Jun 2004 02:00:43 +0500 From: dvd@davidashen.net In-Reply-To: <7359f0490406231324515faa83@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: ab4661fe-eacd-11e9-9e20-41e7f4b1d025 > you can't do that. what if you do the first unlock, > then someone else locks it in the interim. you'll > unlock his lock. bad bad bad. > > -rob It happens in a critical section guarded by another mutex. Noone else can unlock my lock. Should I uncomment the commented-out calls below? void A() { againA: qlock(a); qlock(q); if(x) { qunlock(q); goto againA; } /* canqlock(b); */ qunlock(b); qunlock(q); qunlock(a); } void B() { againB: qlock(b); qlock(q); if(y){ qunlock(q); goto againB; } /* canqlock(a); */ qunlock(a); qunlock(q); qunlock(b); }