* Re: Aborting [not found] <vhir9n7rj0e.fsf@orvarodd.ifi.uio.no> @ 1999-06-19 0:00 ` Keith Thompson 1999-06-21 0:00 ` Aborting Jean-Pierre Rosen 1999-06-19 0:00 ` Aborting Matthew Heaney 1999-06-20 0:00 ` Aborting Dale Stanbrough 2 siblings, 1 reply; 4+ messages in thread From: Keith Thompson @ 1999-06-19 0:00 UTC (permalink / raw) 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.) -- Keith Thompson (The_Other_Keith) kst@cts.com <http://www.ghoti.net/~kst> San Diego Supercomputer Center <http://www.sdsc.edu> <*> One of the great tragedies of ancient history is that Helen of Troy lived before the invention of the champagne bottle. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Aborting 1999-06-19 0:00 ` Aborting Keith Thompson @ 1999-06-21 0:00 ` Jean-Pierre Rosen 0 siblings, 0 replies; 4+ messages in thread From: Jean-Pierre Rosen @ 1999-06-21 0:00 UTC (permalink / raw) 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Aborting [not found] <vhir9n7rj0e.fsf@orvarodd.ifi.uio.no> 1999-06-19 0:00 ` Aborting Keith Thompson @ 1999-06-19 0:00 ` Matthew Heaney 1999-06-20 0:00 ` Aborting Dale Stanbrough 2 siblings, 0 replies; 4+ messages in thread From: Matthew Heaney @ 1999-06-19 0:00 UTC (permalink / raw) On 19 Jun 1999 23:13, Jan Kroken <jankr@nntp.ifi.uio.no> wrote: > Is there any other way than pragma import(C,Exit,"exit") The Ada-name doesn't really matter, but you can't use "exit", because that is a reserved word. Try this: pragma Import (C, Exit_Application, "exit"); or pragma Import (C, C_Exit, "exit"); If you have POSIX bindings, this has already been bound. > I can abort an Ada program from another place than the main procedure? Don't say "abort", because that term has a very specific meaning in an Ada program, different from the one you intend. Yes, you can, by calling your Exit_Application (above). This is a bit of a hack, though, especially if you have a multi-threaded application. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Aborting [not found] <vhir9n7rj0e.fsf@orvarodd.ifi.uio.no> 1999-06-19 0:00 ` Aborting Keith Thompson 1999-06-19 0:00 ` Aborting Matthew Heaney @ 1999-06-20 0:00 ` Dale Stanbrough 2 siblings, 0 replies; 4+ messages in thread From: Dale Stanbrough @ 1999-06-20 0:00 UTC (permalink / raw) Jan Kroken wrote: " Is there any other way than pragma import(C,Exit,"exit") I can abort an Ada program from another place than the main procedure?" How about the following (presuming a non tasking environment)... Do_Not_Handle_This_Exception : Exception; raise Do_Not_Handle_This_Exception; or even Only_Handle_In_The_Main_Procedure : Exception; etc., with an exception handler in the main procedure. Dale ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-06-21 0:00 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <vhir9n7rj0e.fsf@orvarodd.ifi.uio.no> 1999-06-19 0:00 ` Aborting Keith Thompson 1999-06-21 0:00 ` Aborting Jean-Pierre Rosen 1999-06-19 0:00 ` Aborting Matthew Heaney 1999-06-20 0:00 ` Aborting Dale Stanbrough
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox