From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Tue, 7 Nov 2006 19:00:42 -0500 From: ISHWAR RATTAN To: 9fans@cse.psu.edu Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: [9fans] Here is a silly question.. Topicbox-Message-UUID: dc8e22a2-ead1-11e9-9d60-3106f5b1d025 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