comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr>
Subject: Re: Array of tasks
Date: 1997/12/10
Date: 1997-12-10T00:00:00+00:00	[thread overview]
Message-ID: <66mh4g$hak$1@peuplier.wanadoo.fr> (raw)
In-Reply-To: 348D7832.27A4@assist.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 987 bytes --]


Larry Coon a �crit dans le message <348D7832.27A4@assist.org>...
>Here's some contrived code to illustrate what I'm
>trying to do:
>
>procedure main is
>  protected type semaphore is
>    entry seize;
>    procedure release;
>  private
>    available: boolean := true;
>  end semaphore;
>
>  -- The usual implementation of a semaphore.
>  protected body semaphore is separate;
>
>  task type t;
>  task body t is separate;
>
>  task_count: positive;
>begin -- main
>  put ("Enter number of tasks: ");
>  get (task_count);
>  declare
>    subtype task_range is integer range 1..task_count;
>    semaphore_array: array (task_range) of semaphore;

You could declare your task type HERE, it will have visibility on the
semaphores. The only thing you'll loose is the ability to have the task body
separate, but if you use a subprogram rather than a nested block statement,
you would get this feature back.

>    task_array: array (task_range) of t;
>  begin
>    null;
>  end;
>end;







  parent reply	other threads:[~1997-12-10  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-09  0:00 Array of tasks Larry Coon
1997-12-09  0:00 ` Stephen Leake
1997-12-09  0:00   ` Larry Coon
1997-12-10  0:00     ` Mats Weber
1997-12-10  0:00 ` Jean-Pierre Rosen [this message]
1997-12-10  0:00 ` Anonymous
replies disabled

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