From: "Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org>
Subject: Re: Tasking problem (delay)
Date: Sun, 19 Aug 2007 18:26:18 GMT
Date: 2007-08-19T18:26:18+00:00 [thread overview]
Message-ID: <eX%xi.67871$Fc.61276@attbi_s21> (raw)
In-Reply-To: <1187517052.712238.207720@w3g2000hsg.googlegroups.com>
Gerd wrote:
>
> Would this be a good solution for my problem or are there any other
> traps?
I don't see any traps. This design for Worker implies that you need to
change the WD timeout value repeatedly, to arbitrary values, but what
you've presented indicates that it only needs to be changed once to a
fixed value. If that's the case, it would probably be better for the
design to reflect it, encapsulating all information about the timeout
value in the Worker task.
However, this design may have the Worker doing too much. In addition to
the work its supposed to do, it's also doing the work of the watchdog.
It might be better to separate them:
protected WD_Station is
procedure Startup_Completed;
procedure Check_In;
-- Called periodically by monitored task.
entry Wait_For_Startup;
entry Wait;
-- Called by WD task to wait for the monitored task to check in.
private -- WD_Station
...
end WD_Station;
The startup task calls WD_Station.Startup_Complete at the appropriate
time. The worker task would look like
begin -- Worker
Forever : loop
select
accept Data ...;
WD_Station.Check_In;
or
terminate;
end select;
end loop Forever;
end Worker;
There would also be a task WD_Timer:
task body WD_Timer is
begin -- WD_Timer
WD_Station.Wait_For_Startup;
Forever : loop
select
WD_Station.Wait;
or
delay 1.0;
-- Watchdog processing here.
end select;
end loop Forever;
end WD_Timer;
You would need a way for WD_Station to inform WD_Timer that it should
end, if that is a possibility.
--
Jeff Carter
"You empty-headed animal-food-trough wiper."
Monty Python & the Holy Grail
04
next prev parent reply other threads:[~2007-08-19 18:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-15 17:04 Tasking problem (delay) Gerd
2007-08-15 17:34 ` Georg Bauhaus
2007-08-15 18:32 ` Jeffrey R. Carter
2007-08-19 9:50 ` Gerd
2007-08-19 18:26 ` Jeffrey R. Carter [this message]
2007-08-16 5:16 ` anon
2007-08-16 5:17 ` AW: " Grein, Christoph (Fa. ESG)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox