*BSD News Article 52838


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.kei.com!news.mathworks.com!newsfeed.internetmci.com!howland.reston.ans.net!news.nic.surfnet.nl!knmi.nl!rtholtma
From: rtholtma@knmi.nl (Johan Holtman)
Newsgroups: comp.unix.bsd.misc
Subject: READ(2) timeout after minutes?
Date: 17 Oct 1995 13:45:44 GMT
Organization: KNMI, De Bilt, The Netherlands
Lines: 19
Message-ID: <460c28$776@bdanwb.knmi.nl>
NNTP-Posting-Host: bdypws.knmi.nl
X-Newsreader: TIN [version 1.2 PL2]

Hi,

Question about C -vs- Bsd

Suppose the read(2) system call takes a very long time (eg, because of
a file being archived). HOW can I MAKE read(2) timeout after X minutes?

Q1. How can I set a timeout on read for eg. 5 minutes?

I tried to do this with alarm() and signal(). This signal is send
DURING the read, but only processed AFTER the read system call.

Q2. How come? Other signals are directly handled?

If you are that experienced to give the answer, please also send
an email to rtholtma@knmi.nl.

Thanks a lot,
		Johan Holtman