From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] new system calls - semacquire, semrelease From: "Russ Cox" Date: Sat, 25 Mar 2006 11:12:05 -0500 In-Reply-To: <775b8d190603250804l45b2c25ag865617b928ca0ab5@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 20854d24-ead1-11e9-9d60-3106f5b1d025 > there is lock(2) in the public inferno distribution. the implementation is amusing. much like the old trick of storing a byte in a pipe and using it as an interprocess lock. the implementation of the plan 9 semaphore code, by the way, is a bit more involved than one might first expect. the hard part is accessing *addr safely without using a qlock (which would block) in semrelease. (and you can't access *addr while holding a lock either, since you're not allowed to touch user memory while holding locks.) i verified it with spin to double-check. russ