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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!208.49.83.154.MISMATCH!uns-out.usenetserver.com!news.usenetserver.com!pc03.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Getting delay of two events References: <1167320834.211528.106660@a3g2000cwd.googlegroups.com> <1167427143.749548.126410@73g2000cwn.googlegroups.com> <4t9i64-8ac.ln1@newserver.thecreems.com> From: Stephen Leake Date: Sun, 31 Dec 2006 08:04:13 -0500 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:wLopgNxUKr2neEJ5kC20FLyXc2I= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 6b4764597b551759e00d409113 Xref: g2news2.google.com comp.lang.ada:8048 Date: 2006-12-31T08:04:13-05:00 List-Id: Jeffrey Creem writes: >> 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?? > > 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. 4) modify the library task to do the timing. Since the library task knows when the events occur, it needs to do the timing! -- -- Stephe