ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Impl/Glib.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Impl/Glib.pm (file contents):
Revision 1.11 by root, Sun Jul 8 08:52:10 2007 UTC vs.
Revision 1.14 by root, Sat Apr 19 03:57:10 2008 UTC

1=head1 NAME
2
3AnyEvent::Impl::Glib - AnyEvent adaptor for Glib
4
5=head1 SYNOPSIS
6
7 use AnyEvent;
8 use Glib;
9
10 # this module gets loaded automatically as required
11
12=head1 DESCRIPTION
13
14This module provides transparent support for AnyEvent. You don't have to
15do anything to make Glib work with AnyEvent except by loading Glib before
16creating the first AnyEvent watcher.
17
18Glib is probably the most inefficient event loop that has ever seen the
19light of the world: Glib not only scans all its watchers (really, ALL
20of them, whether I/O-related, timer-related or not) during each loop
21iteration, it also does so multiple times and rebuilds the poll list for
22the kernel each time again, dynamically even.
23
24If you create many watchers (as in: more than two), you might consider one
25of the L<Glib::EV>, L<EV::Glib> or L<Glib::Event> modules that map Glib to
26other, more efficient, event loops.
27
28This module uses the default Glib main context for all it's watchers.
29
30=cut
31
1package AnyEvent::Impl::Glib; 32package AnyEvent::Impl::Glib;
2 33
3no warnings; 34no warnings;
4use strict; 35use strict;
5 36
6use Glib (); 37use Glib ();
7 38
8my $maincontext = Glib::MainContext->default; 39our $maincontext = Glib::MainContext->default;
9 40
10sub io { 41sub io {
11 my ($class, %arg) = @_; 42 my ($class, %arg) = @_;
12 43
13 my $self = bless \%arg, $class; 44 my $self = bless \%arg, $class;
51 82
52sub one_event { 83sub one_event {
53 $maincontext->iteration (1); 84 $maincontext->iteration (1);
54} 85}
55 86
561 871;
57 88
89=head1 SEE ALSO
90
91L<AnyEvent>, L<Glib>.
92
93=head1 AUTHOR
94
95 Marc Lehmann <schmorp@schmorp.de>
96 http://home.schmorp.de/
97
98=cut
99

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines