EV::Glib - Embed the glib main loop into EV
use EV::Glib;
If you want to use EV in a Glib/Gtk+ program, then you need to look at the Glib::EV module, not this one, as this module requires you to run EV in your main program.
If you want to use Glib/Gtk+ in an EV program, you are at the right place here.
This module embeds the Glib main loop into EV, that is, EV will also handle Glib events.
This makes Glib compatible to EV. Calls into the EV main loop are more or less equivalent to calls to Glib::MainLoop (but not vice versa, you have to use the EV loop functions).
This module has no dependency on the existing Glib perl interface, as it uses glib directly. The Glib module can, however, be used without any problems (as long as everybody uses shared libraries to keep everybody else happy).
Loading this module will automatically integrate the default context into EV, so normally nothing else is required.
The EV event loop is not the gtk+ main loop. That means that things like
gtk_main_quit will not work at all, as there is no glib mainloop. You
have to use EV's equivalents, i.e. EV::unloop.
This module uses a prepare watcher at lowest priority to dispatch glib events and activate the main context. The context will be deactivated in a check watcher of highest priority.
That means that glib events will be dispatched with lowest priority, and that you cannot call any glib main functions (or functions calling it) on the default mainloop in highest-priority watchers and in lowest-priority prepare watchers.
That means that, after loading this module, EV::loop calls will never
return unless you call EV::unloop explicitly. Future versions might fix
this problem so that Glib keeps the EV loop alive only when it has active
events waiting.
* No documented API to use other main contexts.
EV, Glib::EV, Glib, Glib::MainLoop.
Marc Lehmann <schmorp@schmorp.de> http://home.schmorp.de/