Glib(3)

πŸ“¦
version 2.01 Β· 4 versions
, in epel 9

πŸ’– EV::Glib πŸ’–

Hey bestie! Welcome to the manual for EV::Glib – the Perl module that lets you embed the glib main loop into EV. This page is part of the User Contributed Perl Documentation collection, so you know it's community-made and full of love. πŸ’…


✨ SYNOPSIS ✨

use EV::Glib;

🌸 DESCRIPTION 🌸

Okay so here's the tea β˜•: if you're trying to use EV inside a Glib/Gtk+ program, you're in the wrong place, bestie – you want to look at the Glib::EV module instead. This module right here? It assumes you're running EV in your main program.

If you want to use Glib/Gtk+ in an EV program, then yes, you are absolutely at the right place. 🎯

This module embeds the Glib main loop into EV, which means EV will also handle Glib events. It makes Glib compatible with 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, no cap).

  • The Glib perl module is not used. This module has no dependency on the existing Glib perl interface because it uses glib directly. However, the Glib module can be used without any problems, as long as everybody uses shared libraries to keep everybody else happy. 🫢
  • The default context will be added to EV when the module is loaded. Loading this module automatically integrates the default context into EV, so normally nothing else is required. Slay!
  • There will be no g_main_loop or gtk_main loop available. The EV event loop is not the gtk+ main loop, which means things like gtk_main_quit will not work at all because there is no glib mainloop. You have to use EV's equivalents, i.e. EV::unloop. πŸ’€
  • You cannot call any glib loop functions while its context is active. 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 glib events will be dispatched with lowest priority, and 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. So watch out for that vibe check! ⚠️
  • EV::Glib watchers will (currently) keep the mainloop alive. That means 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. Fingers crossed! 🀞

πŸ¦‹ BUGS πŸ¦‹

  • No documented API to use other main contexts. That's the only bug listed, bestie. πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ

EV, Glib::EV, Glib, Glib::MainLoop. Go check them out! πŸ‘‘


πŸŽ€ AUTHOR πŸŽ€

Marc Lehmann <schmorp@schmorp.de> – http://home.schmorp.de/ – what an icon! 🌈


This page is from perl v5.32.1, dated 2024-09-10, for Glib(3). Stay slay, stay curious, and may your loops always be eventful! πŸ’–βœ¨

πŸ“¦ where this page comes from