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,3674250054e18a5a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 30 Dec 2006 08:40:42 -0600 Date: Sat, 30 Dec 2006 09:33:25 -0500 From: Jeffrey Creem User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Getting delay of two events References: <1167320834.211528.106660@a3g2000cwd.googlegroups.com> <1167427143.749548.126410@73g2000cwn.googlegroups.com> In-Reply-To: <1167427143.749548.126410@73g2000cwn.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4t9i64-8ac.ln1@newserver.thecreems.com> NNTP-Posting-Host: 24.147.74.171 X-Trace: sv3-bnrL9avaLHnVq8G9qEnY7J/I5u+ZQi5MJSrCBRLYr+s6J1KQuk2ROH+QR2g1LaSqFmwhkvbWj6OEgXY!Vz+Cvq4AURdNT4H2ctUNh0zkxb+BZqkwNS17DZHTHfOshLDh+Q/iyHYYP7JxqPqgBIJCh/fmDZmc!YVg= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:8046 Date: 2006-12-30T09:33:25-05:00 List-Id: JPWoodruff@gmail.com wrote: > mark wrote: > >>Hello, >> >>I have an external library with a task and a function getSync which >>returns boolean value (true if it is in sync position, false >>otherwise). Now I would like to create another task which will get the >>time between two sync (i.e. moments of time when the get_sync function >>returns true). Any ideas how can I make it?? > > > > I've been waiting to see somebody smarter than me say something > constructive, but since it's been quiet, I'll venture a guess > I had the same basic reaction which is why I did not respond. Given the defined interface, there is no 'good' way to do this without resorting to polling which awlays feels pretty objectionable. The options I see are 1) Yuck - Create a task that is higher priority than the 'external library task' and have it poll at some fixed rate that you know is faster than the library task could possibly run (at least 2x faster but obviously even faster than that depending on what sort of resolution you were looking for on the timer). 2) Less Yucky - Modify the library task to call someone else at the start and stop. Tends to introduce artificial coupling and start the spider web of coupling that wrecks a nice SW design. 3)Still less - Add two new entry points to the library task that it accepts (with essentially a zero timeout) at the start and stop then rendevous with them from the new task - Again you will need to be sure that the new task is higher priority so that it can 'make it' to the second rendevous point before the library task hits the second accept. Downside of this approach is that it will only really work well for one external observer. I think part of the problem here is that we don't really undestand enough about the problem space to make a good recommendation.