comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <brad.moore@shaw.ca>
Subject: Re: dynamically create tasks
Date: Sat, 11 Oct 2014 12:52:19 -0600
Date: 2014-10-11T12:52:19-06:00	[thread overview]
Message-ID: <u%e_v.357894$JH1.16332@fx08.iad> (raw)
In-Reply-To: <227ad05c-c956-4510-a077-948824e15373@googlegroups.com>

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.

  parent reply	other threads:[~2014-10-11 18:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-11  1:49 dynamically create tasks compguy45
2014-10-11  2:20 ` Shark8
2014-10-11  5:53 ` Niklas Holsti
2014-10-11 13:02   ` compguy45
2014-10-11 14:51     ` Dmitry A. Kazakov
2014-10-11 16:34       ` compguy45
2014-10-11 17:29         ` Ludovic Brenta
2014-10-11 18:52         ` Brad Moore [this message]
2014-10-11  6:01 ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox