From: "Frank J. Lhota" <NOSPAM.FrankLho@rcn.com>
Subject: Re: Problem with tasks
Date: Sat, 4 Sep 2004 06:51:40 -0400
Date: 2004-09-04T06:51:40-04:00 [thread overview]
Message-ID: <41399e3a$0$19705$61fed72c@news.rcn.com> (raw)
In-Reply-To: chc076$i96$1@nemesis.news.tpi.pl
"Magik" <dormar00@poczta.onet.pl> wrote in message
news:chc076$i96$1@nemesis.news.tpi.pl...
> Hello.
>
> 1. Proces_Alarmu.Start -> Yes OK!
> 2. Proces_Alarmu.Stop -> Yes OK!
> But
> 3. Proces_Alarmu.Start - Why does not start again exercise?
Because Proces_Alarmu was not written that way. After the Stop entry was
called, the Proces_Alarmu task exits the loop and finishes its body of code.
Task entries do NOT work like external "goto" statements: if you want
Proces_Alarmu to service the Start entry, then the code for Proces_Alarmu
must be able to get to an "accept Start" call.
Whenever one has a problem of this sort, it is advisable to include a
description of how you want the task to behave. Assuming that Proces_Alarmu
is supposed to alternately accept Start and Stop entries, and print "test"
once a second until the Stop entry was called, then Proces_Alarmu could be
written like this:
task Proces_Alarmu is
entry Start;
entry Stop;
end Proces_Alarmu;
task body Proces_Alarmu is
begin
For_Each_Start_Stop:
loop
accept Start;
Until_Stop:
loop
select
accept Stop;
exit;
or
delay 1.0;
put("test");
end select;
end loop Until_Stop;
end loop For_Each_Start_Stop;
end Proces_Alarmu;
next prev parent reply other threads:[~2004-09-04 10:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-04 8:57 Problem with tasks Magik
2004-09-04 10:51 ` Frank J. Lhota [this message]
2004-09-04 11:02 ` Magik
2004-09-04 13:53 ` Pascal Obry
-- strict thread matches above, loose matches on Subject: below --
2001-07-25 8:52 Carlos Aganzo
2001-07-25 9:32 ` Jean-Pierre Rosen
2001-07-26 1:47 ` DuckE
2001-07-26 11:20 ` Carlos Aganzo
2001-07-26 16:03 ` Ted Dennison
2001-07-26 20:28 ` Ehud Lamm
2001-07-27 12:42 ` Ehud Lamm
2001-07-27 8:15 ` Carlos Aganzo
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox