Re: alarm function under while loop
Rocco Caputo <[email protected]> Sat, 25 Aug 2012 04:15:44 -0400
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
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. --=20 Rocco Caputo <[email protected]> On Aug 22, 2012, at 05:54, Gokul Prasad wrote: > Hi, >=20 > Am setting "alarm" in calling a function to check if particular task > has executed properly or what. >=20 > 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. >=20 > while(end_time >=3D current_time){ > $heap->{next_alarm_time} =3D int(time())+30; > print STDERR "$heap->{next_alarm_time} why ti is = printing\n"; > $kernel->alarm(next_task =3D> > $heap->{next_alarm_time});#$heap->{RESULT}->{event}); > } > Not sure why it is happening? any suggestion.please >=20 >=20 > Regards, > gokul