🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #14102

How to implement an I/O Timeout

#14102
From: Tony Laundrie
Date: Tue, 21 May 1991 16:31
13 lines
908 bytes
I am doing some low-level I/O, and if the cables aren't all connected,
then an inp() statement will hang forever.  How do I set up a timeout in
Turbo C or Microsoft C?

I want to say something like:

		settimeout (2, timeout_error);	/* in two seconds,
						    call timeout_error() */
		x = inp ();			/* attempt input */
		settimeout (0);			/* cancel the timeout, 'cuz
						    we succeeded */

Thanks for the help.  		ttl@cs.wisc.edu
Technical Details
Message-ID: <1991May21.163107.10216@spool.cs.wisc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!uwvax!aura.cs.wisc.edu!ttl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!uwvax!aura.cs.wisc.edu!ttl
From: ttl@aura.cs.wisc.edu (Tony Laundrie)
Newsgroups: comp.sys.ibm.pc
Subject: How to implement an I/O Timeout
Message-ID: <1991May21.163107.10216@spool.cs.wisc.edu>
Date: 21 May 91 16:31:07 GMT
Sender: news@spool.cs.wisc.edu (The News)
Distribution: usa
Organization: U of Wisconsin CS Dept
Lines: 13