comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@goldfinger.mitre.org (Robert I. Eachus)
Subject: Re: Activating tasks at global scope
Date: Wed, 10 Mar 1993 17:11:15 GMT
Date: 1993-03-10T17:11:15+00:00	[thread overview]
Message-ID: <EACHUS.93Mar10121115@goldfinger.mitre.org> (raw)
In-Reply-To: sdm@cs.brown.edu's message of Wed, 10 Mar 1993 03:32:56 GMT

In article <1993Mar10.033256.24718@cs.brown.edu> sdm@cs.brown.edu (Scott Meyers) writes:

  > The code below implements a producer-consumer system containing one
  > producing task, two consuming tasks, and a bounded buffer task.  I am only
  > interested in the tasking interactions, so I've omitted the actual buffer
  > manipulations.  This code works fine under the Ada/ED compiler.  However, I
  > would prefer to put the tasks at global scope rather than nest them inside
  > the producer_consumer procedure.  I tried to do this by putting each task
  > inside a package, but then I couldn't figure out how to activate the tasks
  > when producer_consumer was invoked.  What I'd like is an architecture where
  > the tasks are automatically started before or at the same time the the main
  > subprogram is invoked.

  You were doing fine, but got bitten by a very subtle feature of Ada.
The tasks were all created and elaborated before the main program
executed, but then the main program immediately exited.  The language
reference manual leaves it unspecifed what happens to library tasks in
such a situation, but most implementations now terminate them all if
they are quiescent.  So your tasks disappeared from view before they
could act.

   In any case try hanging your main program, either by putting in a
delay statement or by waiting for input...the elegent final version
should have a clean way of terminating the program, but this will do
for testing.

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



  reply	other threads:[~1993-03-10 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-10  3:32 Activating tasks at global scope Scott Meyers
1993-03-10 17:11 ` Robert I. Eachus [this message]
1993-03-11  3:56   ` Scott Meyers
1993-03-11 17:57     ` Dave Collard x7468
1993-03-11  2:51 ` Michael Feldman
1993-03-11  2:54   ` second half of portable diners Michael Feldman
  -- strict thread matches above, loose matches on Subject: below --
1993-03-15 14:58 Activating tasks at Global Scope Cheryl Marquis
replies disabled

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