… | |
… | |
22 | poll => 'r', |
22 | poll => 'r', |
23 | cb => \&IO::AIO::poll_cb); |
23 | cb => \&IO::AIO::poll_cb); |
24 | |
24 | |
25 | # Glib/Gtk2 |
25 | # Glib/Gtk2 |
26 | add_watch Glib::IO IO::AIO::poll_fileno, |
26 | add_watch Glib::IO IO::AIO::poll_fileno, |
27 | in => sub { IO::AIO::poll_cb, 1 }; |
27 | in => sub { IO::AIO::poll_cb; 1 }; |
28 | |
28 | |
29 | # Tk |
29 | # Tk |
30 | Tk::Event::IO->fileevent (IO::AIO::poll_fileno, "", |
30 | Tk::Event::IO->fileevent (IO::AIO::poll_fileno, "", |
31 | readable => \&IO::AIO::poll_cb); |
31 | readable => \&IO::AIO::poll_cb); |
32 | |
32 | |
… | |
… | |
48 | not well-supported (Linux doesn't allow them on normal files currently, |
48 | not well-supported (Linux doesn't allow them on normal files currently, |
49 | for example), and they would only support aio_read and aio_write, so the |
49 | for example), and they would only support aio_read and aio_write, so the |
50 | remaining functionality would have to be implemented using threads anyway. |
50 | remaining functionality would have to be implemented using threads anyway. |
51 | |
51 | |
52 | Although the module will work with in the presence of other threads, it is |
52 | Although the module will work with in the presence of other threads, it is |
53 | currently not reentrant, so use appropriate locking yourself. |
53 | currently not reentrant, so use appropriate locking yourself, always call |
|
|
54 | C<poll_cb> from within the same thread, or never call C<poll_cb> (or other |
|
|
55 | C<aio_> functions) recursively. |
54 | |
56 | |
55 | =cut |
57 | =cut |
56 | |
58 | |
57 | package IO::AIO; |
59 | package IO::AIO; |
58 | |
60 | |