Hi Marc,
thank you for EV and your detailed intro. I think it's great that you
are engaged in the improvement of event loops as you have a detailed
knowledge of related libraries and system calls and a great experience
in using the various loops. Although I did not have too many problems
with Event and really like to use it, I think it's very worth to have a
look at EV, too.
As I am curious I just started to play with EV. I think I just scratched
its surface, but nevertheles possibly my first impressions might be helpful.
* I think it's great to have Windows support from the beginning, so
programs using EV can be expected to be portable between UNIX and
Windows, similar to the current version of Event.
* For the interface, I like the named parameters interface of Event.
Of course this is a matter of taste (and performance), so this is
just a personal note.
* I found that the timers are not restricted to full second
intervals but support higher resolution. I suggest to mention this
in the docs which currently use to speak of "seconds" (which is
correct but does not necessarily imply that fractions will work as
well).
* Speaking about the docs I find it a bit confusing to mix the
descriptions of methods and watcher constructors. I would suggest
to have a section for the constructors, and another one for the
methods.
* The example provided for data() causes a warning (if run with
PxPerl (a perl 5.8.7) under Windows XP SP 2). This happens because
data() supplies an undefined value, so it seems either setting the
data value or retrieving it does not work. This was tried with
timers, periodic and idle watchers.
* A signal watcher for the "INT" signal causes a Windows exception,
so Windows displays a dialog reporting that perl caused an error
and has to be terminated. Interestingly, the event loop continues
to work while the dialog is presented, so as long as one defers to
press "OK" the callbacks for timers and periodic watchers continue
to be called.
* An io watcher for STDIN does not work (in the mentioned Windows
environment): terminal input does not reach the program, instead
it is propagated to the command like processor after program
termination.
* The STDIN io watcher causes a very high load (100%).
Here is my short test script:
- snip --
# pragmata
use strict;
use warnings;
# modules
use EV;
# install watchers
my $wTimer=EV::timer_ns(10, 10, \&timerCallback);
$wTimer->data('timer');
my $wPeriodic=EV::periodic_ns(4, 4, undef, \&periodicCallback);
$wPeriodic->data('periodic');
my $wSignal=EV::signal_ns('INT', \&signalCallback);
$wSignal->data('signal');
my $wIO=EV::io(\*STDIN, EV::READ, \&ioCallback);
$wIO->data('io');
#my $wIdle=EV::idle(\&idleCallback);
#$wIdle->data('signal');
# loop
EV::loop();
# callbacks
sub timerCallback
{print 'Timer watcher data: ', $_[0]->data(), "\n";}
sub periodicCallback
{print 'Periodoc watcher data: ', $_[0]->data(), "\n";}
sub signalCallback
{print 'Signal watcher data: ', $_[0]->data(), "\n";}
sub ioCallback
{
my $userData=<STDIN>;
print 'IO watcher data: ', $_[0]->data(), "\nRead: $userData";
}
sub idleCallback
{print 'Idle watcher data: ', $_[0]->data(), "\n";}
- snip --
Regards
Jochen