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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 X-Google-Thread: 103376,8893269a4640c798 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-19 19:03:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3F19F86C.9050808@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: terminate applications References: <3F17DF3C.4080204@noplace.com> <3F196773.2060809@noplace.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 66.31.71.243 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc51.ops.asp.att.net 1058666617 66.31.71.243 (Sun, 20 Jul 2003 02:03:37 GMT) NNTP-Posting-Date: Sun, 20 Jul 2003 02:03:37 GMT Organization: Comcast Online Date: Sun, 20 Jul 2003 02:03:37 GMT Xref: archiver1.google.com comp.lang.ada:40516 Date: 2003-07-20T02:03:37+00:00 List-Id: Marin David Condic wrote: > I've got a program that was busy doing a variety of things including > network I/O with winsock calls. In most prior versions of Gnat, it > wouldn't terminate when killing the environment task. I have not checked > it with the latest version of Gnat, so I don't know that it is still > broke. It was too difficult to isolate the exact combination of > circumstances that kept it from getting killed, so I couldn't make a > simple example program without way too much effort. Since it is not a > "Mission Critical" application, I settled for terminating it with a > control-C instead of trying to fix it. Too bad the compiler can't > recognize terminating the environment task as a special case and > duplicate the behavior of the control-C. I don't see why it should. It is a level of abstraction problem. If the OS has threads that are "uninterruptable," that should be treated just like an abort-deferred region in Ada. So as I see it, what is happening is that you abort the environment task, which aborts all other tasks in the environment. But if one task can be stuck in an abort deferred mode you need your code to deal explicitly with that situation. And AFAIK, there are a few cases in Windows where you need the OS to do it for you. This is a difference between Ada 83 and Ada 95. In Ada 83 abort was efectively absolute. If you aborted the environment task, all other tasks were also aborted. Due to the asymmentric nature of the rules, the calling task in a rendezvous was aborted first, but they were both aborted. In RM 9.8(6-11) there is a list of the abort deferred regions: * a protected action; * waiting for an entry call to complete (after having initiated the attempt to cancel it -- see below); * waiting for the termination of dependent tasks; * the execution of an Initialize procedure as the last step of the default initialization of a controlled object; * the execution of a Finalize procedure as part of the finalization of a controlled object; * an assignment operation to an object with a controlled part. The two cases with serious gotcha! potential are putting a blocking call by the CPU inside a protected object, and a Finalize procedure that can do the same thing. (Calls to Initialize and Adjust can do the same thing, but terminating tasks is going to finalize all existing objects.) RM section 9.5.1 (8-18) has a list of the ways you can shoot yourself in the foot within a protected object. -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.