>>>>> "BB" == Bradley Brahms <[EMAIL PROTECTED]> writes:

  BB>   I have not done extensive testing with it.  But from the little
  BB> that I did do it seemed to work.  I have not noticed any problems
  BB> with it.  I am a little concerned if a signal comes in between the
  BB> end of the loop and the loop restarting.

i see the signal window problem you are worried about.

  BB> 1. Prior to the loop, set up a timer event:

  BB>   Event->timer(interval => 5, cb => sub{unloop;});

  BB> This example shows a 5 second timer event.  However, I'm using 60 seconds
  BB> now.  Then around the loop do the following:

  BB>   while (1) { Event::loop; };

didn't you have a loop once type of fix?

  BB> If you ever need to truly end the loop then you will have to add
  BB> some additionally checking so you can get out of the while loop.
  BB> I'm not happy with this solution.  It is clearly a kludge.
  BB> However, the powers the be seem happy enough for now with this
  BB> work around.

yeah, a flag will do. i do have a call that exits the system which calls
some end loop thing. i will need to change it.

one day, i may want to port my simpler c based event loop to perl
(inline::c should make it easy). it was used as the event loop in a
major crawler and was fast and stable. my needs are not much different
than that system's (read/write/timer/signal) and it worked well with a
very simple api. wrapping it in perl should be easy but i don't have the
spare time.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--- Boston Perl Classes ---- July 1-3 ---- http://stemsystems.com/class/ ----
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to