[comp.windows.news] Interrupts and CPS

cocdm@lut.ac.uk (CD Mccartney) (06/01/91)

Organization : Loughborough University, UK.
Keywords: 

Hi,

I am attempting to build a NeWS client program which communicates with the
NeWS server and also recieves signals from another C program. The basic idea
is for the client program to wait, listening for requests from the NeWS server
satisfy those requests and pass the result back to the news server. In
addition, however, the client program asynchronously recieves signals from
another C process. The idea is that as soon as the client program recieves an
interrput it initiates IPC with the signalling C process and fetches some data
from the other process (i.e. the signal was indication that data was ready).
Having got this data from the signalling process the NeWS client program then
passes this onto the NeWS server.

Now my problem is this, I cannot seem to break out of the blocking reads on
the PostScriptInput file waiting for a token, i.e. my main loops looks like
this

    while (!psio_error(PostScriptInput)) {

        if (my_tag_is_here(argument) != 0) {
        }
	else
	    ...
    }

where my_tag_is_here is a CPS generated test for the arrival of a token. Now
what I would like is for this blocking read to be broken by the arrival of a
signal so that my client code go of and process the signal. Once the signal
processing is finished the client can then go back to waiting from tags
from NeWS. I should point out that the code necessary fro processing the signal
is too lengthy to be placed in the signal hadler itself. So, therefore, what
would be ideal is being able to break the blocking tag wait function when a
signal arrives, or waiting in a select on the file descriptor of the
PostScriptInput file until a signal arrives (in which case I process it) or
input arrives in which case I then go into the blocking tag reads, or some
other mechanism.

Any ideas on how to solve this problem would be gratefully received.

Colin.

-- 
Colin "as in Paul" McCartney	    Snail-Mail : Loughborough University,
E-Mail : C.D.Mccartney1@lut.ac.uk                Dept. of Computer Studies,
Phone  : (0509) 263171 x2881			 Loughborough,
Fax    : (0509) 610815				 Leics LE11 3TU, Uk.