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,FREEMAIL_FROM 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!postnews.google.com!w3g2000hsg.googlegroups.com!not-for-mail From: Gerd Newsgroups: comp.lang.ada Subject: Re: Tasking problem (delay) Date: Sun, 19 Aug 2007 02:50:52 -0700 Organization: http://groups.google.com Message-ID: <1187517052.712238.207720@w3g2000hsg.googlegroups.com> References: <1187197490.377548.41000@b79g2000hse.googlegroups.com> <1FHwi.64131$Fc.14346@attbi_s21> NNTP-Posting-Host: 217.247.131.197 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1187517052 18268 127.0.0.1 (19 Aug 2007 09:50:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 19 Aug 2007 09:50:52 +0000 (UTC) In-Reply-To: <1FHwi.64131$Fc.14346@attbi_s21> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: w3g2000hsg.googlegroups.com; posting-host=217.247.131.197; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1484 Date: 2007-08-19T02:50:52-07:00 List-Id: On 15 Aug., 20:32, "Jeffrey R. Carter" wrote: > > The expression in the delay statement (in this case "WD_Delay") is > evaluated once upon reaching the select statement. So this will wait for > a call to Data, or for the value of WD_Delay at the time the select > statement was reached, whichever comes 1st. > > Using unprotected shared variables is not a good idea anyway. I'd > suggest something more like: Thanks, you've pointed me into the right direction. I changed my code such, that the delaytime is no longer a global variable (which in fact was not good coding). task worker is entry Data(...); entry set_delay_time(dt : Duration); -- inserted end worker; task body startup is begin ... -- WD_Delay := 1.0; worker.set_delay_time (1.0); ... end startup; task body worker is WD_Timeout : Duration := 1000.0; begin loop select accept Data (...); or accept set_selay_time (dt : Duration) do WD_Timeout := dt; end; or delay WD_Timeout; trigger_WD; end select; end loop; end worker; Would this be a good solution for my problem or are there any other traps? Gerd