9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@gmx.de
To: 9fans@9fans.net
Subject: Re: [9fans] A question about timeout
Date: Tue, 14 Jul 2009 16:47:44 +0200	[thread overview]
Message-ID: <f82e903fc3e9170d4f190e30a9a6a931@gmx.de> (raw)
In-Reply-To: <4A5C9454.9080801@tecmav.com>

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

to interrupt on i/o operations you send a note to the process.
for ioproc(2), here is iointerrupt() that does that. for timeouts here is
a alarm() function (see sleep(2)) that will fire a note on you when the alarm expires.
notes should also work for rendezvous()/alt(), but a better way is to include
a timeout/cancel channel in your alt() operation. as a example see
/sys/src/cmd/rio/time.c. here we have a central timer process
that does a sleep and sends a message to channels associated
with timers when they expire.

--
cinap

[-- Attachment #2: Type: message/rfc822, Size: 2747 bytes --]

From: Adriano Verardo <a.verardo@tecmav.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] A question about timeout
Date: Tue, 14 Jul 2009 16:21:08 +0200
Message-ID: <4A5C9454.9080801@tecmav.com>

I'm porting some Unix applications which implement a timeout on
read/write/accept/... calls using select().

In previous versions I did the same by signals but with problems
due to the behaviour  of the interrupted system call.

Select() is also used to choose among channels waiting for I/O.

How can I implement channel selection and secure timeouts
without using APE ?

Re-write some pieces is not a problem, I prefer a "pure" 8c implementation.


adriano

  reply	other threads:[~2009-07-14 14:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 14:21 Adriano Verardo
2009-07-14 14:47 ` cinap_lenrek [this message]
2009-07-14 17:41   ` Adriano Verardo
2009-07-14 19:01     ` cinap_lenrek

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=f82e903fc3e9170d4f190e30a9a6a931@gmx.de \
    --to=cinap_lenrek@gmx.de \
    --cc=9fans@9fans.net \
    /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).