Yes, I pointed this out earlier, but (in a private email to me) Kiril
pointed out that you cannot just clear one event in a list, you can only
clear them all. I suggested that he could use the peek method to see which
ones where out there, clear the list, and then just re-add all the ones he
wants to keep. It's not very neat, but it would avoid having to add a hack
to the code.

The underlining problem seems to be that that there is no easy way to
enumerate and track queued future events, which I'm not so sure is a wise
thing to want in the first place. I think it could lead to some nasty and
and hard to debug race conditions, if one gets to mess with the event queue
too much and too often. But then again, I don't really know the internal
guts of POE that well yet (but would love to know.)

- MW

-----Original Message-----
From: Rocco Caputo [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 24, 2001 8:01 PM
To: Kirill
Cc: Rocco Caputo; [EMAIL PROTECTED]
Subject: Re: select() as sleep()


If I read the messages correctly, you need to keep refreshing a timer
whenever activity occurs.  POE::Kernel's alarm() and delay() methods
do this: they clear existing timed events for the given state before
setting new ones.

So every time you call this:

  $kernel->delay( timeout => 5 );

The previous 'timeout' delay is cleared and a new one is set for five
seconds into the future.  To clear the delay it without setting a new
one, you would call this:

  $kernel->delay( 'timeout' );

Since delay() clears the previous one (if any), it removes the old
'timeout' delay.  Since there is no time for a new 'timeout', no new
one is set.

This may not help if I misunderstood your previous message.

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net


On Thu, May 24, 2001 at 06:24:51PM -0400, Kirill wrote:
> Great! Are we going to have an official way to do timeouts in
> the next release? Or did I miss something that's already there?
> 
> Kirill
> 
> 
> > I've patched POE::Kernel to import Time::HiRes' sleep() along with
> > time(), if the module is available.  This sleep() will convert floats
> > into usecs and call usleep internally.
> > 
> > I've patched POE::Kernel::Select to use sleep() (which may be
> > Time::HiRes' if available) when there are no filehandles and $^O eq
> > 'MSWin32'.  Otherwise it still uses four-argh select().
> > 
> > This'll be in the next release.
> 
> 

Reply via email to