9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] Semaphores
Date: Sun, 22 Oct 2006 19:21:37 -0400	[thread overview]
Message-ID: <ee9e417a0610221621h2a35a87bha7ff9c33f2d1c3b7@mail.gmail.com> (raw)
In-Reply-To: <7871fcf50610221605y124a0b9dnccd7e3e420a0ad03@mail.gmail.com>

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


  reply	other threads:[~2006-10-22 23:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22 23:05 Joel Salomon
2006-10-22 23:21 ` Russ Cox [this message]
2006-10-22 23:29 ` Steve Simon
  -- strict thread matches above, loose matches on Subject: below --
2002-01-25 14:53 [9fans] semaphores Russ Cox
2002-01-16  7:48 nigel
     [not found] <rsc@plan9.bell-labs.com>
2002-01-16  3:44 ` Russ Cox
2002-01-16  3:54   ` Scott Schwartz
2002-01-16 11:14     ` Boyd Roberts
2002-01-16 15:47     ` Ronald G Minnich
2002-01-25 10:30   ` Ralph Corderoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee9e417a0610221621h2a35a87bha7ff9c33f2d1c3b7@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).