1package POE::XS::Loop::Poll;
2use strict;
3use vars qw(@ISA $VERSION);
4BEGIN {
5  unless (defined &POE::Kernel::TRACE_CALLS) {
6    # we ignore TRACE_DEFAULT, since it's not really standard POE and it's
7    # noisy
8    *POE::Kernel::TRACE_CALLS = sub () { 0 };
9  }
10  $VERSION = '1.000';
11  eval {
12    # try XSLoader first, DynaLoader has annoying baggage
13    require XSLoader;
14    XSLoader::load('POE::XS::Loop::Poll' => $VERSION);
15    1;
16  } or do {
17    require DynaLoader;
18    push @ISA, 'DynaLoader';
19    bootstrap POE::XS::Loop::Poll $VERSION;
20  }
21}
22
23require POE::Loop::PerlSignals;
24
25if ((POE::Kernel::TRACE_FILES() || POE::Kernel::TRACE_EVENTS())
26    && !tracing_enabled()) {
27  print POE::Kernel::TRACE_FILE "<xx> ", __PACKAGE__, " was built without tracing enabled, build with perl Makefile.PL --trace to enable tracing\n";
28}
29
30# everything else is XS
311;
32
33__END__
34
35=head1 NAME
36
37POE::XS::Loop::Poll - an XS implementation of POE::Loop, using poll(2).
38
39=head1 SYNOPSIS
40
41  use POE::Kernel { loop => 'POE::XS::Loop::Poll' };
42
43=head1 DESCRIPTION
44
45This class is an implementation of the abstract POE::Loop interface
46written in C using the poll(2) system call.
47
48Signals are left to POE::Loop::PerlSignals.
49
50=head1 SEE ALSO
51
52POE, POE::Kernel, POE::Loop.
53
54=head1 BUGS
55
56Relies upon small fd numbers, but then a lot of code does.
57
58Will fail badly if your code uses POE from more than one Perl thread.
59
60poll() on OS X doesn't support ptys, hence POE::XS::Loop::Poll won't
61work with ptys on OS X.
62
63If you see an error:
64
65  POE::XS::Loop::Poll hasn't been initialized correctly
66
67then the loop hasn't been loaded correctly, in POE <= 1.287 the
68following:
69
70  # this doesn't work
71  use POE qw(XS::Loop::Poll);
72
73will not load the loop correctly, you will need to do:
74
75  use POE::Kernel { loop => 'POE::XS::Loop::Poll' };
76  use POE;
77
78=head1 LICENSE
79
80POE::XS::Loop::Poll is licensed under the same terms as Perl itself.
81
82=head1 AUTHOR
83
84Tony Cook <tonyc@cpan.org>
85
86=cut
87
88=for poe_tests
89
90sub skip_tests {
91  $ENV{POE_EVENT_LOOP} = "POE::XS::Loop::Poll";
92  $ENV{POE_LOOP_USES_POLL} = 1;
93  return;
94}
95
96=cut
97