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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:4004:: with SMTP id n4-v6mr10398609ita.36.1524595522588; Tue, 24 Apr 2018 11:45:22 -0700 (PDT) X-Received: by 2002:a9d:bc8:: with SMTP id 66-v6mr1732983oth.10.1524595522165; Tue, 24 Apr 2018 11:45:22 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!k65-v6no4120279ita.0!news-out.google.com!b185-v6ni4210itb.0!nntp.google.com!f63-v6no4121137itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Apr 2018 11:45:21 -0700 (PDT) In-Reply-To: <3f521db0-5ee2-40ae-95af-26ef6b843722@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.113.16.86; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.113.16.86 References: <3f521db0-5ee2-40ae-95af-26ef6b843722@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Nested Task Entry Question From: Shark8 Injection-Date: Tue, 24 Apr 2018 18:45:22 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2734 X-Received-Body-CRC: 536203579 Xref: reader02.eternal-september.org comp.lang.ada:51691 Date: 2018-04-24T11:45:21-07:00 List-Id: 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.