On May 27, 12:28am, Bradley Brahms wrote:
> Uri,
> I have not done extensive testing with it. But from the little that I did
> do it seemed to work. I have not noticed any problems with it. I am a
> little concerned if a signal comes in between the end of the loop and the
> loop restarting.
>
> The work around is as follows:
>
> 1. Prior to the loop, set up a timer event:
>
> Event->timer(interval => 5, cb => sub{unloop;});
>
> This example shows a 5 second timer event. However, I'm using 60 seconds
> now. Then around the loop do the following:
>
> while (1) { Event::loop; };
>
> If you ever need to truly end the loop then you will have to add some
> additionally checking so you can get out of the while loop. I'm not happy
> with this solution. It is clearly a kludge. However, the powers the be
> seem happy enough for now with this work around.
>
> Brad
I've tested the workaround that Joshua suggested, namely Event::loop(5)
wrapped with a while (1) { }. This works as well as does the above, so far
as I can tell, although I am likewise nervous about signal catching. I
suggest that the method of exiting being calling unloop(undef) or something
similar; this should be workable into the perl event code (I'll see if I can
get around to this...)
-Allen
--
Allen Smith http://cesario.rutgers.edu/easmith/
September 11, 2001 A Day That Shall Live In Infamy II
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin