From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sun, 22 Oct 2006 19:21:37 -0400 From: "Russ Cox" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Semaphores In-Reply-To: <7871fcf50610221605y124a0b9dnccd7e3e420a0ad03@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7871fcf50610221605y124a0b9dnccd7e3e420a0ad03@mail.gmail.com> Topicbox-Message-UUID: d20b45f8-ead1-11e9-9d60-3106f5b1d025 You can't use signals for wakeup on Plan 9. There is no sigprocmask to turn off note delivery (so no atomic sections) and no sigsuspend (so no atomic check a condition and go to sleep). Instead you need to use rendezvous(2). For a good example of using rendezvous to do sleep and wakeup, read the implementation of qlock, in /sys/src/libc/9sys/qlock.c. Everywhere it says (*_rendezvousp) just pretend it says rendezvous. (The thread library replaces the rendezvous that qlock uses, but that detail is not relevant here.) Russ