Newsgroups: comp.sys.transputer
From: pm@robots.ox.ac.uk (Philip McLauchlan)
Subject: Problem with 3L C
Organization: Robotics Research Group, Engineering Science Dept, Oxford, UK.
Date: Thu, 21 Jul 1994 22:36:29 GMT
Message-ID: <1994Jul21.223629.29240@percy.robots.ox.ac.uk>


We are using 3L C on C40's, and have come across a simple problem whose
solution defeats us at present. We want to make a "clean" exit from a program
when a relevant code is read on stdin on the root C40 from the keyboard.
This involves reading characters using getchar(), but unfortunately that
locks up the I/O and doesn't let us print things while waiting for keyboard
input. What we need is a function to poll the keyboard for input, returning
a special value if no input is present. Such a function is provided by Inmos C,
namely pollkey(). An alternative solution would be to catch any termination
signal raised by the program upon control-c being pressed to terminate the
server. However the signal module implemented in 3L C only allows for signals
to be raised explicitly by raise(), i.e. pressing control-c doesn't raise a
signal. Does anyone know how to get around this problem?

Phil McLauchlan
Robotics Research Group
Oxford University

