From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,9ae5242be9f6f6d8 X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Aborting Date: 1999/06/21 Message-ID: <7kkr2r$1pr$1@wanadoo.fr>#1/1 X-Deja-AN: 492011045 Content-Transfer-Encoding: 8bit References: Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 X-Complaints-To: abuse@wanadoo.fr X-Trace: wanadoo.fr 929951643 1851 164.138.70.41 (21 Jun 1999 07:54:03 GMT) Organization: Adalog Mime-Version: 1.0 NNTP-Posting-Date: 21 Jun 1999 07:54:03 GMT Newsgroups: comp.lang.ada Date: 1999-06-21T07:54:03+00:00 List-Id: Keith Thompson a �crit dans le message ... >Jan Kroken 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