comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Riehle <laoXhai@ix.netcom.com>
Subject: Re: Ada 95 tasking problems with Ada 83 code
Date: Thu, 31 Aug 2000 21:17:48 -0700
Date: 2000-09-01T19:41:38+00:00	[thread overview]
Message-ID: <39AF2DEC.71D8B897@ix.netcom.com> (raw)
In-Reply-To: 39AF20CE.FDBDFFFE@mtws.visicom.com



Wayne Lydecker wrote:

>
>
> That's it!  Turns out that the test program that starts the main
> program creates a task that displays a menu and then uses a call to
> text_io.get_line.  Evidently, the get_line in a task blocks the main
> program.
>
> I tried text_io.look_ahead, but end_of_line was always False.  Do
> I have to check each character for <CR>?  Text_IO.Get_Immediate
> works fine for single characters, but again I would have to search
> for <CR>.
>
> Would it work OK to reverse what is going on here and create a new task
> to launch the main program and keep the test driver as a procedure?
> Would the text_io.get_line still block the main program?
>
> Thanks again Richard, I was about to perform a major re-write.  I
> am almost complete with my task ;-)

Wayne,

It is often the case that the initial Get_Line is associated with an entry call in
an Ada 83
task for task initialization.  For example, the task needs to get its own name or
some other
kind of ID.   This had to be done with an entry call in Ada 83 but can be
accomplished
in Ada 95 more easily and with less overhead.   Simply create a task type with a
discriminant
and decclare or allocate the task with the actual parameter for the discriminant.
If the
information required is a composite type (String or record), simply use a access
discriminant.

This can save some time, eliminate start-up blocking, and is evaluated at
elaboration time
instead of during actual task execution.  That is, there is no blocking and no
context
switching overhead.  This technique becomes especially useful if you are doing
dynamic
allocation of the task at different stages of the life of a program.

Reminder:  you still need to take a look at RMA if you have 100 concurrent tasks.

Richard Riehle
richard@adaworks.com





  reply	other threads:[~2000-09-01  4:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-30  0:00 Ada 95 tasking problems with Ada 83 code Wayne Lydecker
2000-08-30  0:00 ` Richard Riehle
2000-08-30  0:00   ` Wayne Lydecker
2000-08-31  0:00     ` Jeff Creem
2000-08-31 20:07     ` Robert Barron
2000-09-01  3:21   ` Wayne Lydecker
2000-09-01  4:17     ` Richard Riehle [this message]
     [not found]       ` <39B046AE.A05C82AA@mtws.visicom.com>
2000-09-02  1:04         ` Jeff Creem
2000-09-05 19:11           ` Richard Riehle
2000-09-05 17:12         ` Richard Riehle
2000-09-06  0:19           ` Ted Dennison
2000-09-06  2:38           ` Wayne Lydecker
2000-09-07  5:35             ` Simon Wright
2000-09-02 22:54       ` Pat Rogers
2000-09-05 17:31         ` Richard Riehle
2000-09-05 18:51           ` Pat Rogers
2000-09-05 19:00             ` Richard Riehle
2000-09-05 19:33               ` Pat Rogers
2000-09-01 20:01     ` Robert A Duff
2000-08-31 16:00 ` Bill Dale
2000-08-31 17:57   ` Richard Riehle
replies disabled

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