comp.lang.ada
 help / color / mirror / Atom feed
From: news.crd.ge.com!e7sa!groleau@uunet.uu.net  (Wes Groleau x1240 C73-8)
Subject: Re: Tasking in Ada
Date: 16 Sep 93 17:11:58 GMT	[thread overview]
Message-ID: <CDGIFy.I3G@crdnns.crd.ge.com> (raw)

In article <1993Sep15.041622.17841@rat.csc.calpoly.edu> kgatlin@galaxy.csc.calp
oly.edu (Kang Su Gatlin) writes:
>I have hit a snag with Ada.  I need to create dynamic tasks that know which
>task they are.
>
>I can't seem to find a way to pass information to tasks efficiently.  I want
>all the tasks to run simultaneously so that the creation and execution of
>the tasks can be done in t(1) time.  

Someone will undoubtedly post a better way, but here's one.  I have left out
a lot of the trivial stuff that most programmers can figure out in 20 minutes
with a reference manual and an error message.  (If you've ever written an Ada
program you'll do it in one minute with no manual.)  If you decide to use this,
you can use my name if you wish, but I'd prefer nothing else (no e-mail address
,
company name, street address, phone number, etc., please)

Wes Groleau

task body SAMPLE is

   My_ID : ID_TYPE := No_ID;

begin

   accept IDENTIFICATION ( ID : ID_TYPE ) do
      My_ID := ID;
   end IDENTIFICATION;

   -- the following loop is only necessary if you need them all
   -- to start at approximately the same time.  There is no way
   -- to start all at EXACTLY the same time.  I have a way to
   -- get a more accurate start time than this, but it's kludgey.
   while Global_Start_Flag /= Go loop
      delay Some_Small_Amount;
   end loop;

   -- do the task

end SAMPLE;

begin -- main program

  for I in Array_Of_Tasks'RANGE loop
    Array_Of_Tasks ( I ) . IDENTIFICATION ( I );
  end loop;

  Global_Start_Flag := Go;

end;  -- main program

-----------

             reply	other threads:[~1993-09-16 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-16 17:11 Wes Groleau x1240 C73-8 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-17 14:37 Tasking in Ada Wes Groleau x1240 C73-8
1993-09-15 18:51 Raymond Blaak
1993-09-15 17:34 Robert Kitzberger
1993-09-15 17:32 Mark A Biggar
1993-09-15 15:17 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-09-15 13:47 howland.reston.ans.net!wupost!cs.utexas.edu!utnut!utcsri!csri.toronto.edu
1993-09-15  4:16 Kang Su Gatlin
replies disabled

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