From: Jeffrey Creem <jeff@thecreems.com>
Subject: Re: Getting delay of two events
Date: Sat, 30 Dec 2006 09:33:25 -0500
Date: 2006-12-30T09:33:25-05:00 [thread overview]
Message-ID: <4t9i64-8ac.ln1@newserver.thecreems.com> (raw)
In-Reply-To: <1167427143.749548.126410@73g2000cwn.googlegroups.com>
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.
next prev parent reply other threads:[~2006-12-30 14:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-28 15:47 Getting delay of two events mark
2006-12-29 21:19 ` JPWoodruff
2006-12-30 14:33 ` Jeffrey Creem [this message]
2006-12-31 13:04 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox