ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-AIO/AIO.pm
Revision: 1.4
Committed: Fri Jun 10 02:09:49 2011 UTC (12 years, 11 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +2 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3 root 1.2 AnyEvent::AIO - truly asynchronous file and directory I/O
4 root 1.1
5     =head1 SYNOPSIS
6    
7     use AnyEvent::AIO;
8     use IO::AIO;
9    
10     # can now use any of the aio requests your IO::AIO module supports
11     # as long as you use an event loop supported by AnyEvent.
12    
13     =head1 DESCRIPTION
14    
15     This module is an L<AnyEvent> user, you need to make sure that you use and
16     run a supported event loop.
17    
18     Loading this module will install the necessary magic to seamlessly
19     integrate L<IO::AIO> into L<AnyEvent>, i.e. you no longer need to concern
20     yourself with calling C<IO::AIO::poll_cb> or any of that stuff (you still
21     can, but this module will do it in case you don't).
22    
23     The AnyEvent watcher can be disabled by executing C<undef
24     $AnyEvent::AIO::WATCHER>. Please notify the author of when and why you
25     think this was necessary.
26    
27     =cut
28    
29     package AnyEvent::AIO;
30    
31 root 1.4 use common::sense;
32 root 1.1
33     use AnyEvent ();
34     use IO::AIO ();
35    
36     use base Exporter::;
37    
38 root 1.3 our $VERSION = '1.1';
39 root 1.1 our $WATCHER;
40    
41 root 1.3 my $guard = AnyEvent::post_detect {
42 root 1.4 $WATCHER = AE::io IO::AIO::poll_fileno, 0, \&IO::AIO::poll_cb;
43 root 1.1 };
44 root 1.3 $WATCHER ||= $guard;
45 root 1.1
46     IO::AIO::_on_next_submit \&AnyEvent::detect;
47    
48     =head1 SEE ALSO
49    
50     L<AnyEvent>, L<Coro::AIO> (for a more natural syntax).
51    
52     =head1 AUTHOR
53    
54     Marc Lehmann <schmorp@schmorp.de>
55     http://home.schmorp.de/
56    
57     =cut
58    
59     1