* can not abort allocated tasks
@ 1987-10-09 15:22 nico nieh
1987-10-12 13:27 ` fitch
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: nico nieh @ 1987-10-09 15:22 UTC (permalink / raw)
I am writing a simulation program using Ada task facilities.
What I wanted to do is to be able to abort a task which
is activated by using the allocator.
The program segment looks like,
task type pool is
entry draw(which : out integer); -- contains an infinite loop
end
type t_pool is access pool;
pool_1 : t_pool;
pool_2 : pool;
begin
....
....
pool_1 := new pool;
...
...
abort pool_1;
However, both DEC/ADA and Verdix Ada compiler gave syntax error at the
abort statement.
According to the LRM,
abort_statement ::= ABORT task_name {,task_name};
the abort statement only takes task_names not pointers to task.
Is there any way to abort task pool_1 ?
Ko-Haw Nieh
General Electric Company
Corporate Research and Development
nieh@ge-crd.arpa
518-387-7431
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can not abort allocated tasks
1987-10-09 15:22 can not abort allocated tasks nico nieh
@ 1987-10-12 13:27 ` fitch
1987-10-12 15:53 ` Jonathan P. Biggar
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: fitch @ 1987-10-12 13:27 UTC (permalink / raw)
By using ".all" you can refer to a task object via a pointer.
So you want to specify
abort POOL_1.all;
If, however, this task does have an infinite loop, your abort
may not help you, since an "aborted" task may not become
completed until it hits a syncronization point, e.g. an accept
statement. Better to remove the loop and using a less severe
method to stop the task.
Geoff Fitch
Intermetrics, Inc.
733 Concord Ave.
Cambridge, MA 02138
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can not abort allocated tasks
1987-10-09 15:22 can not abort allocated tasks nico nieh
1987-10-12 13:27 ` fitch
@ 1987-10-12 15:53 ` Jonathan P. Biggar
1987-10-12 17:37 ` Jeff Bartlett
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jonathan P. Biggar @ 1987-10-12 15:53 UTC (permalink / raw)
In article <7586@steinmetz.steinmetz.UUCP> nieh@moose.steinmetz (nico nieh) writes:
task type pool is
entry draw(which : out integer); -- contains an infinite loop
end
type t_pool is access pool;
pool_1 : t_pool;
begin
pool_1 := new pool;
abort pool_1;
>Is there any way to abort task pool_1 ?
The statement you need is:
abort pool_1.all;
The '.all' component refers to the entire object accessed by the access
type.
Jon Biggar
jonab@cam.unisys.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can not abort allocated tasks
1987-10-09 15:22 can not abort allocated tasks nico nieh
1987-10-12 13:27 ` fitch
1987-10-12 15:53 ` Jonathan P. Biggar
@ 1987-10-12 17:37 ` Jeff Bartlett
1987-10-12 19:54 ` Claudio Nieder
1987-10-12 21:17 ` Michael Murphy
4 siblings, 0 replies; 6+ messages in thread
From: Jeff Bartlett @ 1987-10-12 17:37 UTC (permalink / raw)
How about
abort task_1.all;
since you wanted to stop what the pointer references not stop the pointer.
Jeff Bartlett
Research Triangle Institute jb@rti.rti.org mcnc!rti!jb
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can not abort allocated tasks
1987-10-09 15:22 can not abort allocated tasks nico nieh
` (2 preceding siblings ...)
1987-10-12 17:37 ` Jeff Bartlett
@ 1987-10-12 19:54 ` Claudio Nieder
1987-10-12 21:17 ` Michael Murphy
4 siblings, 0 replies; 6+ messages in thread
From: Claudio Nieder @ 1987-10-12 19:54 UTC (permalink / raw)
In article <7586@steinmetz.steinmetz.UUCP> nieh@moose.steinmetz
(nico nieh) writes:
>What I wanted to do is to be able to abort a task which
>is activated by using the allocator.
>
>... the abort statement only takes task_names not pointers to task.
So you have to dereference the pointer ...
procedure TASK_REFERENCE is
task type TASK_TYPE;
type TASK_POINTER is access TASK_TYPE;
TASK_INSTANCE : TASK_POINTER;
task body TASK_TYPE is
begin
null; -- may be a never ending story ...
end TASK_TYPE;
begin
TASK_INSTANCE := new TASK_TYPE;
abort TASK_INSTANCE.all;
end TASK_REFERENCE;
... and your program will be accepted by the compiler.
Harry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can not abort allocated tasks
1987-10-09 15:22 can not abort allocated tasks nico nieh
` (3 preceding siblings ...)
1987-10-12 19:54 ` Claudio Nieder
@ 1987-10-12 21:17 ` Michael Murphy
4 siblings, 0 replies; 6+ messages in thread
From: Michael Murphy @ 1987-10-12 21:17 UTC (permalink / raw)
You need to dereference the task access, e.g.
abort pool_1.all;
That way you are aborting the task rather than the access value.
-- Michael P. Murphy
-- UUCP: sun!elxsi!elky!murphy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1987-10-12 21:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1987-10-09 15:22 can not abort allocated tasks nico nieh
1987-10-12 13:27 ` fitch
1987-10-12 15:53 ` Jonathan P. Biggar
1987-10-12 17:37 ` Jeff Bartlett
1987-10-12 19:54 ` Claudio Nieder
1987-10-12 21:17 ` Michael Murphy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox