ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Glib-EV/EV.pm
Revision: 1.1
Committed: Sat Nov 24 16:10:22 2007 UTC (16 years, 5 months ago) by root
Branch: MAIN
CVS Tags: rel-0_1
Log Message:
*** empty log message ***

File Contents

# Content
1 =head1 NAME
2
3 Glib::EV - Coerce Glib into using the EV module as event loop.
4
5 =head1 SYNOPSIS
6
7 use Glib::EV;
8
9 # example with Gtk2:
10 use Gtk2 -init;
11 use Glib::EV;
12 use EV; # any order
13 my $timer = EV::timer 1, 1, sub { print "I am here!\n" };
14 main Gtk2;
15 # etc., it just works
16
17 # You can even move the glib mainloop into a coroutine:
18 use Gtk2 -init;
19 use Coro;
20 use Coro::EV;
21 use Glib::EV;
22 async { main Gtk2 };
23 # ... do other things
24
25 =head1 DESCRIPTION
26
27 This module coerces the Glib event loop to use the EV high performance
28 event loop as underlying event loop, i.e. EV will be used by Glib for all
29 events.
30
31 This makes Glib compatible to EV. Calls into the Glib main loop are more
32 or less equivalent to calls to C<EV::loop> (but not vice versa, you
33 I<have> to use the Glib mainloop functions).
34
35 =over 4
36
37 =item * The Glib perl module is not used.
38
39 This module has no dependency on the existing Glib perl interface, as it
40 uses glib directly. The Glib module can, however, be used without any
41 problems (as long as evereybody uses shared libraries to keep everybody
42 else happy).
43
44 =item * The default context will be changed when the module is loaded.
45
46 Loading this module will automatically "patch" the default context of
47 libglib, so normally nothing more is required.
48
49 =item * Glib does not allow recursive invocations.
50
51 This means that none of your event watchers might call into Glib
52 functions or functions that might call glib functions (basically all Gtk2
53 functions). It might work, but that's your problem....
54
55 =cut
56
57 package Glib::EV;
58
59 use Carp ();
60 use EV ();
61
62 our $default_poll_func;
63
64 BEGIN {
65 $VERSION = 0.1;
66
67 require XSLoader;
68 XSLoader::load (Glib::EV, $VERSION);
69
70 $default_poll_func = install (undef);
71 }
72
73 =back
74
75 =cut
76
77 =head1 BUGS
78
79 * No documented API to patch other main contexts.
80
81 =head1 SEE ALSO
82
83 L<EV>, L<Glib>, L<Glib::MainLoop>.
84
85 =head1 AUTHOR
86
87 Marc Lehmann <schmorp@schmorp.de>
88 http://home.schmorp.de/
89
90 =cut
91
92 1
93