comp.lang.ada
 help / color / mirror / Atom feed
* Tasking In Ada 83 "Question"
@ 1997-03-18  0:00 Michael Ibarra
  1997-03-18  0:00 ` James A. Squire
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ibarra @ 1997-03-18  0:00 UTC (permalink / raw)



Does anyone know???

I have a task, and I want to perform some action when I know that my
task has terminated.  I can't tell when it has terminated.  My task
looks something like:

Task Body timer is
begin
loop
  select 
     accept receive_call do
     null;
     end receive_call;
  or 
     terminate;
  end select;
end loop;
end timer;
 
My problem is that in order to check the terminated attribute of the
task, I need to with the package that is parent/master to the task,
therefore preventing it from becoming terminated.

I'm doing:
WITH task_Package;
.
.
.
IF task_package.timer'TERMINATED THEN...


This is NEVER true.  Is there any way that I can konw when this task
has terminated.  I wanted to perform some jobs ONLY after this task
is terminated.

Any ideas???

Thanks in advance,


Michael Ibarra




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tasking In Ada 83 "Question"
  1997-03-18  0:00 Tasking In Ada 83 "Question" Michael Ibarra
@ 1997-03-18  0:00 ` James A. Squire
  0 siblings, 0 replies; 2+ messages in thread
From: James A. Squire @ 1997-03-18  0:00 UTC (permalink / raw)



In article <332F3050.74B8@mccabe.com>,
Michael Ibarra  <ibarra@mccabe.com> wrote:
>I have a task, and I want to perform some action when I know that my
>task has terminated.  I can't tell when it has terminated.  My task
>looks something like:
>
>Task Body timer is
>begin
>loop
>  select 
>     accept receive_call do
>     null;
>     end receive_call;
>  or 
>     terminate;
>  end select;
>end loop;
>end timer;
> 
>My problem is that in order to check the terminated attribute of the
>task, I need to with the package that is parent/master to the task,
>therefore preventing it from becoming terminated.

I don't quite understand this statement.  If the task is pretty much
like you have it there, withing it's parent seems to have absolutely
nothing to do with preventing it from becoming terminated.  Or else
I don't have enough information here.

It seems to me that what prevents this task from terminating is the
mere fact that the program is still running, since the only way it
terminates (apart from some other task aborting it or an exception
being raised from within) is when all other tasks including the main
task are finished - hence when the program is finished.  There is no
stop entry, and the loop is endless.  The terminate statement only
ensures that the program won't be left hanging if every other task
is finished.

>This is NEVER true.  Is there any way that I can konw when this task
>has terminated.  I wanted to perform some jobs ONLY after this task
>is terminated.

If you want to do anything after such a task terminates, then you'll
have to pick some other way for the task to terminate, it seems to
me.  The options I'm aware of are:  (1) adding a Stop entry, (2) adding
some condition that exits the loop, (3) abort the task.  It looks like
(2) is closest to what you are looking for since you are treating
termination of this task as if it is non-deterministic to the other tasks
in your program.

Either that or you need to give us more info.
-- 
James Squire           mailto:m193884 no junk mail allowed@csehp1.mdc.com
MDA Avionics Tools & Processes
McDonnell Douglas Aerospace              http://www.mdc.com/
Opinions expressed here are my own and NOT my company's




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-03-18  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-18  0:00 Tasking In Ada 83 "Question" Michael Ibarra
1997-03-18  0:00 ` James A. Squire

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