Show quoted text> First off, the optional 'timestamp' argument seems somewhat
> problematic with respect to blocking. For example... if I have
> blocking turned on and I specify an event 10 seconds in the future,
> but the next event cannot happen for 20 seconds, how long do we sleep?
> Likewise, what if I specified something 10 seconds in the past? We
> could just come up with some arbitrary definition of what is the
> "correct" behavior, but I have a feeling somebody else would be able
> to argue why that's wrong. So, my current thinking is that the
> timestamp parameter is incompatible with blocking.
I don't personally need support for blocking with timestamp.
However, I don't think there's any inherent problem with it, so I
wouldn't bother purposefully removing support.
Don't think about $args{timestamp} in relation to real time. It
_defines_ what "now" is, so by definition it is always identical to what
you should think of as the current time.
If your $args{seconds} is 60, and your oldest event is 20 seconds prior
to $args{timestamp}, then you have to wait 40 seconds. Whether the time
stamp is in the past or the future in relation to the real wall clock
doesn't matter at all. One timestamp is specified, there is no need to
consider time() whatsoever.
Show quoted text> Second, I tried to rationalize what would be the meaning if
> min_iterations existed, but was set to zero. I couldn't come up with
> anything. So, my current thinking is that min_iterations must be
> greater than zero or else that is the same as having it unset.
I'm fine with that interpretation, and I think my patch acts this way.
Show quoted text> Third, I tried integrating your patch, and then I started looking
> it over and re-arranging the code. And, eventually, I had sub event()
> to the point where it was if (min_iterations) {do this} else {do that}
I'd like to see the code before I interpret this: it's easy to unfactor
any code to the point where it's separated into two disparate cases, but
at what cost?
Show quoted text> hold_for_event:
<snip>
Show quoted text> test_event:
<snip>
Show quoted text> record_event:
> "An event happened at this time. Deal with it"
(Is this equivalent to my factored out _record_event, or whatever I called it?)
These seem fine to me overall. I'm not necessarily convinced the
separation is necessary or useful, but I don't mind it.
Does this separation eliminate the need for the (block => ) parameter to
the constructor?
Show quoted text> I believe this gives you all of the functionality you are looking for,
> and them some. Please let me know if you see anything wrong with
> this approach.
Seems fine enough to me.
Alan