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 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 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
>>
>> On Aug 22, 2012, at 05:54, Gokul Prasad wrote:
>>
>>> Hi,
>>>
>>> Am setting "alarm" in calling a function to check if particular task
>>> has executed properly or what.
>>>
>>> when i place the below code under while loop this alarm function is
>>> not being called, but when i comment while loop, it is just works fine
>>> correctly.
>>>
>>> while(end_time >= current_time){
>>> $heap->{next_alarm_time} = int(time())+30;
>>>print STDERR "$heap->{next_alarm_time} why ti is printing\n";
>>> $kernel->alarm(next_task =>
>>> $heap->{next_alarm_time});#$heap->{RESULT}->{event});
>>> }
>>> Not sure why it is happening? any suggestion.please
>>>
>>>
>>> Regards,
>>> gokul
>>