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-7-bit X-Google-Thread: 103376,f009ea55b3656834 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Q:finalization or task terminate first? Date: 1997/03/05 Message-ID: #1/1 X-Deja-AN: 223196398 References: <331CF2F4.6B79@bix.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-03-05T00:00:00+00:00 List-Id: In article <331CF2F4.6B79@bix.com>, Tom Moran wrote: >Given a package body with a declaration of an object descended from >Ada.finalization.controlled, and also a task with a select-terminate >alternative, when the main program that with's this package reaches its >end, which will happen first: the Finalize call or the task termination? Task termination happens first. Then finalization. See 7.6.1(4). In this case, the "master" is the environment task. This makes sense: you can't finalize things while tasks are still meddling with them. See also 10.2(26) and 9.8(20), and note that finalization is abort-deferred. And note that all Finalize procedures are library-level procedures. These paragraphs ensure that there's no need to await tasks twice for the same master (that is, once finalization starts for a given master, all tasks dependent on that master are dead and no more will be created). - Bob