Hi,
To give more context on the issue, the following lines are not
working(alarm function is being called ) but later runs fine
NOT WORKING!!!!! (recursive call thro alarm)
------------------------
delete_sub(){
.
.
.
.
if($heap->{RESULT}->{delete_sub_status} ne 'deleted'){
$heap->{next_delete_alarm_time} = int(time())+30;
# $_[KERNEL]->alarm(get_del_status =>
$heap->{next_delete_alarm_time}) if($end_time >= time);
$_[KERNEL]->alarm(delete_sub =>
$heap->{next_delete_alarm_time}) if($end_time >= time);
$heap->{RESULT}->{delete_sub_status_counter}++;
}
}
WORKING!!!(recursive call thro alarm)
------------------
get_poll_status(){
.
.
.
if($heap->{RESULT}->{poll_success} != 1){
# while($end_time >= time){
$heap->{next_poll_alarm_time} = int(time())+30;
$_[KERNEL]->alarm(get_poll_status =>
$heap->{next_poll_alarm_time}) if($end_time >= time);
$heap->{RESULT}->{poll_status_error_counter}++;
# }
}else{
$_[KERNEL]->yield("get_delivery_status",$pollquerystring);
}
}
Please let me know if am missing something in it!!, it works at one
stage not at other, as i told, i couldnt get it running with
run_while() function, googling didnt gave me much info nor poe
cookbook.
On Fri, Nov 2, 2012 at 12:45 PM, Gokul Prasad <
nhgoku...@gmail.com> wrote:
> If i run using run_whie() it gives me error, will the kernel->alarm()
> work fine wthin if loop?
>
> Even with TRACE_REFCNT am not getting any clue!!!
>
> -gokul
>
>
> On Sat, Aug 25, 2012 at 1:45 PM, Rocco Caputo <
rca...@pobox.com> wrote:
>> Hi, Gokul.
>>
>> POE::Kernel->alarm() enqueues an alarm, but it is not like the built-in alarm(). POE's alarms are dispatched by POE::Kernel in between callbacks. Your while() loop pre-empts the dispatcher, so the enqueued alarms never occur.
>>
>> If your program must delay there, you can use POE::Kernel->run_while() to run POE's dispatcher while a variable is true. Set the variable false from the callback you are waiting for.
>>
>> --
>> Rocco Caputo <
rca...@pobox.com>