comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr>
Subject: Re: Aborting
Date: 1999/06/21
Date: 1999-06-21T07:54:03+00:00	[thread overview]
Message-ID: <7kkr2r$1pr$1@wanadoo.fr> (raw)
In-Reply-To: yecu2s394x6.fsf@king.cts.com


Keith Thompson a �crit dans le message ...
>Jan Kroken <jankr@nntp.ifi.uio.no> writes:
>> Is there any other way than pragma import(C,Exit,"exit") I can
abort
>> an Ada program from another place than the main procedure?
>
>Raise an exception that's handled only in the main program.  (I'm not
>sure what this does to tasks, though.)
>
Here is a solution that works OK in the presence of tasking:
(assume you have the proper "with Ada.Task_Identification":
In a *library* package, declare:
   Main_Task : Task_ID := Current_Task;
This will give you the task Id of the anonymous task which is the
ancestor of all other tasks.

Then do:
   Abort_Task (Main_Task);

It will terminate all tasks, but all controlled objects will be
properly finalized (not sure this would happen if you call the C
"exit" function).
---------------------------------------------------------
           J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://perso.wanadoo.fr/adalog






  reply	other threads:[~1999-06-21  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <vhir9n7rj0e.fsf@orvarodd.ifi.uio.no>
1999-06-19  0:00 ` Aborting Keith Thompson
1999-06-21  0:00   ` Jean-Pierre Rosen [this message]
1999-06-19  0:00 ` Aborting Matthew Heaney
1999-06-20  0:00 ` Aborting Dale Stanbrough
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox