> 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

Reply via email to