[comp.unix.questions] Non- Blocking Input

boutell@freezer.it.udel.edu (Tom Boutell) (11/24/90)

Hi, folks. I'm the author of The Broken Throne, a multiplayer internet game.
My particular pain today is, I can't find a terribly portable way to check
for input from the user. I know it's not a fully portable thing in any
case, but is there a good source of multiple solutions for multiple machines
that I can incorporate into my code with a judicious bunch of #ifdefs?

For my own (SunOS) use, the code gets hold of the fd of stdin, then uses
ioctl(I_PEEK) on that to determine whether there's a key available. Works
like a charm but most folks can't do it. Is the nodelay() keyword available
under *other people's* versions of Curses the most portable method around?

One other question: usleep(xxx) sleeps for xxx microseconds under SunOS.
Is there a more portable equivalent? I need a good way of giving about a
tenth of a second back to the OS to avoid writing CPU- hungry code. (I'd
prefer to use input signals, but I keep running into situations where
I stop receiving signals because another came in as I handled the first.
Very frustrating business.)

-- 
THE TECHNOLOGY HOUSE: An idea whose time has come!
My girlfriend is a pseudo- aardvark. She is quite insistent on this point.
And remember- when all else fails- and no one else can help-
boutell@freezer.it.udel.edu

boutell@freezer.it.udel.edu (Tom Boutell) (11/24/90)

An additional note: I am particularly desperate for a BSD solution to this
problem, since that represents the bulk of the folks wanting a solution.
(Again,t he problem is how to check for available input on stdin.)

-- 
THE TECHNOLOGY HOUSE: An idea whose time has come!
My girlfriend is a pseudo- aardvark. She is quite insistent on this point.
And remember- when all else fails- and no one else can help-
boutell@freezer.it.udel.edu