[comp.lang.ada] FORCEXIT VMS-Ada prog containing busy task - HOW?

paul@cernvax.cern.ch (paul burkimsher) (04/25/91)

How can I $FORCEXIT a VMS-Ada program that contains a task that's busy
doing a text_io.get_line?


I have a main processing task that wants to read from any one of several
VMS mailboxes, whenever they have data to be read. Text_io.getline
commits me to performing one particular MBX read that may not yet have
data. I therefore bury each read inside a mbx_reader_task.
The mbx_reader_tasks can
now rendezvous (RV) with the main task whenever the readers actually have some
data.

So, the main task sits in a selective wait:
LOOP
...
SELECT
   ACCEPT RV_mbx1_reader( ... );
OR ACCEPT RV_mbx2_reader( ... );
OR TERMINATE;
END SELECT
...
END LOOP;

The mbx1_reader_task is trivial (maybe mine is too trivial?):

LOOP
   text_io.get_line(...);
   RV_mbx1_reader( ... );
END LOOP;

My problem stems from the fact that from time to time, I wish to re-start
the main program (which runs as a detached process). First, of course, I
have to stop the existing detached process. I login and
run a program which calls $FORCEXIT thus:

      forcex(STATUS => return_status,
             PIDADR => process_id_type(pid)
	    );

Unfortunately, my wonderful program DOES NOT STOP and I have to do a
$STOP/ID=nnnnnn
in order to zap it. This is sad, as with STOP all my programs output files
are NOT flushed and so I lose lots of output data (ie all of it). I believe
$FORCEXIT would flush first. Am I right?

How can I achieve what I am trying to do, ie close down a tasking program
and also close it's output files gracefully?

I suspect that my program does not stop bacause of the reader task that
hasn't had a chance to execute "OR TERMINATE" (but I may be wrong).

This is a long standing problem that I can't avoid any more.

Any help MUCH appreciated, THANKS!!!

Paul Burkimsher
European Laboratory for Particle Physics,
CERN
CH-1211 Geneva 23
Switzerland

Tel: +41-22-767-4915
Fax: +41-22-767-3900

paul@vxcern.cern.ch
paul AT cernvax (BITNET)
...!uunet!cernvax!paul (UUCP)
vxcern::paul (HEPNET) (22.190=22718)
paul%cern.cernvax@uk.ac.ean-relay (Janet)