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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:92d4:: with SMTP id u203-v6mr14751564iod.27.1524607249245; Tue, 24 Apr 2018 15:00:49 -0700 (PDT) X-Received: by 2002:a9d:53c8:: with SMTP id i8-v6mr425160oth.0.1524607248982; Tue, 24 Apr 2018 15:00:48 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!2.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!f63-v6no4252841itc.0!news-out.google.com!b185-v6ni4326itb.0!nntp.google.com!f63-v6no4252840itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Apr 2018 15:00:48 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=73.205.150.94; posting-account=Ru7E4QoAAAC_HiQ2D8LjZ7rh1mbTNcVn NNTP-Posting-Host: 73.205.150.94 References: <3f521db0-5ee2-40ae-95af-26ef6b843722@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <86979cc7-1e24-46af-9015-c19f4ec668c2@googlegroups.com> Subject: Re: Nested Task Entry Question From: NiGHTS Injection-Date: Tue, 24 Apr 2018 22:00:49 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:51697 Date: 2018-04-24T15:00:48-07:00 List-Id: On Tuesday, April 24, 2018 at 2:45:24 PM UTC-4, Shark8 wrote: > On Tuesday, April 24, 2018 at 10:57:29 AM UTC-6, NiGHTS wrote: > > I have two tasks: Task P and Task C. Task P creates Task C, but Task C must call entries into Task P. > > > > I can't seem to figure out how to make an entry on a parent task executable by a child task. > > > > I am eternally grateful for your assistance! Thank you! > > Task Type Parent is > Entry Start; > Entry Child_Call( Value : Natural ); > Entry Stop; > End Parent; > > Task Type Child( P : not null access Parent ) is > End Child; > > Task Body Child is > Begin > Ada.Text_IO.Put_Line( "Inside Child; Setting Parent value."); > P.Child_Call( 23 ); > End Child; > > Task Body Parent is > Internal : Natural := 77; > Begin > accept Start do > Ada.Text_IO.Put_Line( "Starting Parent (Value:" & > Natural'Image(Internal) & " )." ); > end Start; > accept Child_Call (Value : in Natural) do > Ada.Text_IO.Put_Line( "Call from child." ); > Internal := Value; > end Child_Call; > accept Stop do > Ada.Text_IO.Put_Line( "Stopping Parent (Value:" & > Natural'Image(Internal) & " )." ); > end Stop; > End Parent; > > --... > Parent_Task.Start; > -- Hidden Child call happens after Start finishes, due to being queued on entry. > Parent_Task.Stop; > > ---------------- > Also, note that the putline happens *BEFORE* the output of the Parent-task; this is because the queuing on the entry happens, due to the parent having to wait for the START entry. My guess is that you meant to instantiate the child task type into the parent declaration area, though forgot to do that. Still I see your point. Thank you for your help.