From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6bccf7d57f63267 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Tasking problem (delay) References: <1187197490.377548.41000@b79g2000hse.googlegroups.com> <1FHwi.64131$Fc.14346@attbi_s21> <1187517052.712238.207720@w3g2000hsg.googlegroups.com> In-Reply-To: <1187517052.712238.207720@w3g2000hsg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1187547978 12.201.97.213 (Sun, 19 Aug 2007 18:26:18 GMT) NNTP-Posting-Date: Sun, 19 Aug 2007 18:26:18 GMT Organization: AT&T ASP.att.net Date: Sun, 19 Aug 2007 18:26:18 GMT Xref: g2news2.google.com comp.lang.ada:1488 Date: 2007-08-19T18:26:18+00:00 List-Id: 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