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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx08.iad.POSTED!not-for-mail From: Brad Moore User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: dynamically create tasks References: <47e42c27-69ba-44fc-861f-c230f5ac04f4@googlegroups.com> <3c9ecb97-de0b-45b4-bee8-e52d12e9a07d@googlegroups.com> <1h09hiyg52lja$.1cot9bcyumuwk.dlg@40tude.net> <227ad05c-c956-4510-a077-948824e15373@googlegroups.com> In-Reply-To: <227ad05c-c956-4510-a077-948824e15373@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 68.145.219.148 X-Complaints-To: internet.abuse@sjrb.ca X-Trace: 1413053530 68.145.219.148 (Sat, 11 Oct 2014 18:52:10 UTC) NNTP-Posting-Date: Sat, 11 Oct 2014 18:52:10 UTC Date: Sat, 11 Oct 2014 12:52:19 -0600 X-Received-Bytes: 2479 X-Received-Body-CRC: 1208252062 Xref: news.eternal-september.org comp.lang.ada:22351 Date: 2014-10-11T12:52:19-06:00 List-Id: On 14-10-11 10:34 AM, compguy45@gmail.com wrote: > I cant. I have to sync it using entries. > There are a number of unknown requirements here. Are the tasks to be dynamically created on the stack, or on the heap? Can the sync be by task entries, or by protected object entries? How does a task determine which one is the next to be signalled? Can the tasks be in an array, and an incrementing array index be used to determine the next one, or does the task need to be linked more dynamically, such as by a linked list of tasks? I presume this is a homework assignment, and that the exercise is to involve only task entry calls, and that otherwise the other details are left to the student. An interesting solution would be one that lets you arbitrarily hook individual tasks together that are created either dynamically on the stack (as a task declaration), or dynamically from the heap (via the new keyword). For this, I'd suggest having a Connect task entry that accepts an access type for the task as a parameter. entry Connect (Next_Task : T_Access); This can be used to connect the tasks together in a circular list. Then another entry to Signal a task, and another that the main task can call to wait for the initial Signalled task to accept once the initially signalled task has signalled by the previous task in the task ring. eg. entry Signal; entry Wait_For_All_Tasks; Good luck.