I'm no POE master, but I think $kernel->alarm and delay clears any other
previously timed events when you use $kernel->alarm(timeout_state) with no
other args.

Lines 586-589 in the POE::Kernel man page explains this feature I think.

- MW

-----Original Message-----
From: Kirill [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 3:51 PM
To: [EMAIL PROTECTED]
Subject: Timeouts


I am trying to add a timeout option to PoCoC::UserAgent,
but I couldn't find an official way to implement timeouts
in POE. The problem with the obvious delay/alarm solution
is that there is no alarm_remove method. I hacked one up
as shown below, but I'd like to know if there is any
other way that I missed.

Kirill


# to be called by client right after adding an alarm
sub last_seqnum
{
    return $queue_seqnum;
}

# pass an alarm's seqnum to kill it
sub alarm_remove
{
    my $seqnum = shift;
    $seqnum = shift if ref $seqnum;
    my $index = 0;
    $index ++ while $index < @kr_alarms and $kr_alarms[$index]->[ST_SEQ] !=
$seqnum;
    return unless $index < @kr_alarms;
    {% ses_refcount_dec2 $kr_alarms[$index]->[ST_SESSION], SS_ALCOUNT %}
    splice @kr_alarms, $index, 1;
    warn "Alarm #$seqnum removed\n" if TRACE_EVENTS;
}

Reply via email to