On Friday 11 January 2002 01:29 am, you wrote: > On Thu, Jan 10, 2002 at 10:42:39PM -0500, Jason Boxman wrote: > > I think I have it figured out, now, but for clarification. > > > > If I have a session that does something with a SocketFactory, and I want > > to implement and internal timeout, I should do a delay_set( 'event', 120 > > ), then for each successive success event, an alarm_adjust( id, 0 ) > > followed immediately by an alarm_adjust( id, 120 )? > > The first alarm_adjust() call is redundant. The alarm should not be > moved when the delta time is zero seconds. From around line 2215 in > Kernel.pm: > > # Nothing to do if the delta is zero. > return $kr_events[$alarm_index]->[ST_TIME] unless $delta;
Fair enough, then if a single second had gone by and I did my call as above, my future timeout would now by +239 seconds, yes? Each successive call to alarm_adjust() in my SuccessEvent would add around another 120 seconds to the timeout, effecively nullifying it. So how would implement a timeout? I thought I'd try $delta = alarm_adjust( $id ), alarm_adjust( $id , (( time + 120 ) - $delta) to arrive at the difference necessary to bump the alarm back up to only 120 seconds hence, but perhaps my math is off. Sometimes doing (120 + time) - $delta would yield a slighty negative number instead of a small positive one (I'm using Time::HiRes). Any idea what I should be doing? > -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net
