comp.lang.ada
 help / color / mirror / Atom feed
* TASKS
@ 1992-10-06  2:24 elroy.jpl.nasa.gov!swrinde!ringer!mperez
  0 siblings, 0 replies; 6+ messages in thread
From: elroy.jpl.nasa.gov!swrinde!ringer!mperez @ 1992-10-06  2:24 UTC (permalink / raw)


I am learning ada and I was having trouble with TASK. My code looks
something like this
 
PROCEDURE joe IS
   ......
   ......
   declarations
   .....

TASK Name IS
     entry filename(...);
END;

TASK body Name IS
begin
    Accept filename(...);
         ...........
         statements
         ...........
    End filename;
end Name;

Begin
   while (....) Loop
       Name.filename(....);
   end loop;
end joe;

It seems like the TASK is executed one time then I always get a
TASKING_ERROR. I tried putting an exception to handle this error but
it didn't work. I think there is something about TASK that I don't understand
if anyone has any comments please let me know.
                                                    Thanks.

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

* Re: TASKS
@ 1992-10-06 11:23 van-bc!cs.ubc.ca!utcsri!rpi!usc!sdd.hp.com!spool.mu.edu!darwin.sura.net!c
  0 siblings, 0 replies; 6+ messages in thread
From: van-bc!cs.ubc.ca!utcsri!rpi!usc!sdd.hp.com!spool.mu.edu!darwin.sura.net!c @ 1992-10-06 11:23 UTC (permalink / raw)


In article <1992Oct6.022450.9087@ringer.cs.utsa.edu> mperez@ringer.cs.utsa.edu 
(Michael Perez) writes:
>I am learning ada and I was having trouble with TASK. My code looks
>something like this
> 
Your task body performs the accept only once, after that the task becomes 
terminated, and you get a TASKING_ERROR when calling the entry a second time.
Modify your task as follows:

>
>TASK body Name IS
>begin
  loop
   select
>    Accept filename(...);
>         ...........
>         statements
>         ...........
>    End filename;
   or
     terminate;
   end select;
  end loop;
>end Name;



-- 
Boris Pelakh		Ada Project Leader          pelakh@convex.com
		     Convex Computer Corporation
"If winning isn't important, why keep score ?"	-- Lt. Worf, Star Trek TNG.
			

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

* Re: TASKS
@ 1992-10-06 19:47 Bob Kitzberger
  0 siblings, 0 replies; 6+ messages in thread
From: Bob Kitzberger @ 1992-10-06 19:47 UTC (permalink / raw)


mperez@ringer.cs.utsa.edu (Michael Perez) writes:

>TASK body Name IS
>begin
>    Accept filename(...);
>         ...........
>         statements
>         ...........
>    End filename;
>end Name;

>It seems like the TASK is executed one time then I always get a
>TASKING_ERROR. 

You need to put a loop..end loop pair around the accept statement in the task,
otherwise your task Name will accept a single entry call, and then terminate.

	.Bob.
----------------
Bob Kitzberger          VisiCom Laboratories, Inc.
rlk@visicom.com         10052 Mesa Ridge Court, San Diego CA 92121 USA
                        +1 619 457 2111    FAX +1 619 457 0888

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

* tasks
@ 2002-02-26  9:01 Edmund
  2002-02-26 11:35 ` tasks Frank J. Lhota
  2002-02-26 11:37 ` tasks Larry Kilgallen
  0 siblings, 2 replies; 6+ messages in thread
From: Edmund @ 2002-02-26  9:01 UTC (permalink / raw)


I'm a Ada novice and have this question:
can tasks be implemented across 2 different packages?





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

* Re: tasks
  2002-02-26  9:01 tasks Edmund
@ 2002-02-26 11:35 ` Frank J. Lhota
  2002-02-26 11:37 ` tasks Larry Kilgallen
  1 sibling, 0 replies; 6+ messages in thread
From: Frank J. Lhota @ 2002-02-26 11:35 UTC (permalink / raw)


"Edmund" <demund_98@yahoo.com.sg> wrote in message
news:3c7b4e05$1@news.starhub.net.sg...
> I'm a Ada novice and have this question:
> can tasks be implemented across 2 different packages?

To answer this, we need to be a little clearer on what you mean by
"implemented across 2 different packages". A task declared in package A can
make use of everything in the specifications of the program units for which
A has a "with" clause, so in a sense, the implementation of a task can be
spread across many packages. If you're asking if a task or task type can be
declared in package A and then have its body appear in package B, then the
answer is no.





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

* Re: tasks
  2002-02-26  9:01 tasks Edmund
  2002-02-26 11:35 ` tasks Frank J. Lhota
@ 2002-02-26 11:37 ` Larry Kilgallen
  1 sibling, 0 replies; 6+ messages in thread
From: Larry Kilgallen @ 2002-02-26 11:37 UTC (permalink / raw)


In article <3c7b4e05$1@news.starhub.net.sg>, "Edmund" <demund_98@yahoo.com.sg> writes:
> I'm a Ada novice and have this question:
> can tasks be implemented across 2 different packages?

Yes.  You can think of a task as an execution context.  A package
is more like a collection of subprograms and types.  For beginners
doing small programs, the most important consideration for package
design is to restrict a package to "similar" things so that when
certain types and subprograms are needed for a particular program,
you can easily specify inclusion of the appropriate package.



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

end of thread, other threads:[~2002-02-26 11:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26  9:01 tasks Edmund
2002-02-26 11:35 ` tasks Frank J. Lhota
2002-02-26 11:37 ` tasks Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
1992-10-06 19:47 TASKS Bob Kitzberger
1992-10-06 11:23 TASKS van-bc!cs.ubc.ca!utcsri!rpi!usc!sdd.hp.com!spool.mu.edu!darwin.sura.net!c
1992-10-06  2:24 TASKS elroy.jpl.nasa.gov!swrinde!ringer!mperez

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