| 1 |
NAME |
| 2 |
Glib::EV - Coerce Glib into using the EV module as event loop. |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use Glib::EV; |
| 6 |
|
| 7 |
# example with Gtk2: |
| 8 |
use Gtk2 -init; |
| 9 |
use Glib::EV; |
| 10 |
use EV; # any order |
| 11 |
my $timer = EV::timer 1, 1, sub { print "I am here!\n" }; |
| 12 |
main Gtk2; |
| 13 |
# etc., it just works |
| 14 |
|
| 15 |
# You can even move the glib mainloop into a coroutine: |
| 16 |
use Gtk2 -init; |
| 17 |
use Coro; |
| 18 |
use Coro::EV; |
| 19 |
use Glib::EV; |
| 20 |
async { main Gtk2 }; |
| 21 |
# ... do other things |
| 22 |
|
| 23 |
DESCRIPTION |
| 24 |
This module coerces the Glib event loop to use the EV high performance |
| 25 |
event loop as underlying event loop, i.e. EV will be used by Glib for |
| 26 |
all events. |
| 27 |
|
| 28 |
This makes Glib compatible to EV. Calls into the Glib main loop are more |
| 29 |
or less equivalent to calls to "EV::loop" (but not vice versa, you |
| 30 |
*have* to use the Glib mainloop functions). |
| 31 |
|
| 32 |
* The Glib perl module is not used. |
| 33 |
This module has no dependency on the existing Glib perl interface, |
| 34 |
as it uses glib directly. The Glib module can, however, be used |
| 35 |
without any problems (as long as evereybody uses shared libraries to |
| 36 |
keep everybody else happy). |
| 37 |
|
| 38 |
* The default context will be changed when the module is loaded. |
| 39 |
Loading this module will automatically "patch" the default context |
| 40 |
of libglib, so normally nothing more is required. |
| 41 |
|
| 42 |
* Glib does not allow recursive invocations. |
| 43 |
This means that none of your event watchers might call into Glib |
| 44 |
functions or functions that might call glib functions (basically all |
| 45 |
Gtk2 functions). It might work, but that's your problem.... |
| 46 |
|
| 47 |
BUGS |
| 48 |
* No documented API to patch other main contexts. |
| 49 |
|
| 50 |
SEE ALSO |
| 51 |
EV, Glib, Glib::MainLoop. |
| 52 |
|
| 53 |
AUTHOR |
| 54 |
Marc Lehmann <schmorp@schmorp.de> |
| 55 |
http://home.schmorp.de/ |
| 56 |
|