From: ISHWAR RATTAN <rattan@cps.cmich.edu>
To: 9fans@cse.psu.edu
Subject: [9fans] Here is a silly question..
Date: Tue, 7 Nov 2006 19:00:42 -0500 [thread overview]
Message-ID: <Pine.GSO.4.61.0611071856060.1587@cps-kurali.cps.cmich.edu> (raw)
How does one do a time-out using alarm() call? It seems
that syscall read() is not aborted by alarm()..
int rd, try = 0;
char buf[1024];
while(try < 2) {
alarm(2 * 1000);
rd = read(0, buf, 1024);
alarm(0);
if(rd > 0) {
write(1, buf, rd);
break;
}
}
-ishwar
next reply other threads:[~2006-11-08 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-08 0:00 ISHWAR RATTAN [this message]
2006-11-08 0:11 ` Russ Cox
2006-11-08 0:16 ` erik quanstrom
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=Pine.GSO.4.61.0611071856060.1587@cps-kurali.cps.cmich.edu \
--to=rattan@cps.cmich.edu \
--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).