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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8893269a4640c798 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-18 02:48:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!usenet-fr.net!enst.fr!not-for-mail From: christoph.grein@eurocopter.com Newsgroups: comp.lang.ada Subject: Re: terminate applications Date: Fri, 18 Jul 2003 11:36:20 +0200 (MET DST) Organization: ENST, France Message-ID: Reply-To: grein@egypt.otn.eurocopter.de NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1058521719 5394 137.194.161.2 (18 Jul 2003 09:48:39 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Fri, 18 Jul 2003 09:48:39 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: 6IMTBr8YmtfVhuLNpUl8QQ== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:40460 Date: 2003-07-18T11:36:20+02:00 All the methods shown so far work only on a non-tasking program, and then it is easy to terminate the application. Ada also has (in package Command_Line) a procedure to set the exit status. But beware when you use tasking: with Something; procedure Main is task Work; begin ... ... raise Some_Exc; ... exception when Some_Exc => null; -- terminate now end Main; When Some_Exc is raised, Main (the main task) waits for termination of subordinate tasks. So if you stop the main task via an exception the program will happily go on if there are other tasks (e.g. task Work or library tasks in Something) still running. A common way to write a tasking application is to have a main program without any declarations and with a null statement: with Something; procedure Main is begin null; end Main; All the work is done in Something. You face the complicated problem how to terminate all these dependent tasks. Raising an exception in one task will silently terminate the task without informing any other task (except when in rendez-vous). To find a solution for this problem is not easy. It depends on your application and has to be designed by you. You could use the abort statement, but there are abort-deferred regions... In C there is no built-in tasking so (AFAIK) exiting a program with a call to exit(0) is easy (as as easy as in Ada if you have no tasking). What you have to do if you are running threads in C, I do not know. Perhaps then the problem is similar.