Danny Faught wrote:
>Is Event the best choice to recommend for event-driven programming? I
>see that there's also the EventServer module - but given that it hasn't
>changed in a few years, can we assume that it's obsolete? I also see
>that POE looks like a viable choice. It seems to be more complex than
>Event, but perhaps a more powerful option? POE's revision is less than
>1, though, so is it still beta quality?
Event is presently the best general purpose event
loop for Perl. However, various people are
dissatisfied with some of the design decisions
and are working on superior replacements.
>Also, I've tripped over some big signal concurrency issues looking at
>writing an event loop using a blocking select call. I'm used to only
>looking for signals, but adding IO and select makes it much more of a
>mess. I looked at the Event source to see how it deals with it. It
>appears that Event tries to be fail-safe by regularly polling the file
>descriptors rather than pausing in the poll or select call waiting for
>IO or a signal to happen.
No, Event tries its best to wait inside poll/select.
AFAIK, this is the proper way to inform the
kernel that the process is idle.
> I can't tell how often it's called though
>(seems to be happening in the null_loops_per_second function).
null_loops_per_second is only for benchmarking.
It is never used in a real application.
>How efficient is the implementation?
It's pretty good. Perl is always the bottleneck.
If you don't use the Perl features then i believe
Event is still close to an optimal implementation
(given the design decisions).
Best wishes,
-j
_____________________________________________________________
Thank you for choosing LinuxQuestions.
http://www.linuxquestions.org