logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

"IO::Async::Loop::Glib" - use "IO::Async" with Glib or GTK

Author

       Paul Evans <leonerd@leonerd.org.uk>

perl v5.38.2                                       2024-02-25                         IO::Async::Loop::Glib(3pm)

Constructor

new
          $loop = IO::Async::Loop::Glib->new()

       This function returns a new instance of a "IO::Async::Loop::Glib" object. It takes no special arguments.

Description

       This subclass of "IO::Async::Loop" uses the "Glib::MainLoop" to perform read-ready and write-ready tests.

       The appropriate "Glib::IO" sources are added or removed from the "Glib::MainLoop" when notifiers are
       added or removed from the set, or when they change their "want_writeready" status. The callbacks are
       called automatically by Glib itself; no special methods on this loop object are required.

Methods

       There are no special methods in this subclass, other than those provided by the "IO::Async::Loop" base
       class.

   loop_once
          $loop->loop_once( $timeout )

       This method calls the iteration() method on the underlying "Glib::MainContext". If a timeout value is
       supplied, then a Glib timeout will be installed, to interrupt the loop at that time. If Glib indicates
       that any callbacks were fired, then this method will return 1 (however, it does not mean that any
       "IO::Async" callbacks were invoked, as there may be other parts of code sharing the Glib main context.
       Otherwise, it will return 0.

Name

       "IO::Async::Loop::Glib" - use "IO::Async" with Glib or GTK

See Also

       •   Glib - Perl wrappers for the GLib utility and Object libraries

       •   Gtk2 - Perl interface to the 2.x series of the Gimp Toolkit library

Synopsis

          use IO::Async::Loop::Glib;

          my $loop = IO::Async::Loop::Glib->new();

          $loop->add( ... );

          ...
          # Rest of GLib/Gtk program that uses GLib

          Glib::MainLoop->new->run();

       Or

          $loop->run;

       Or

          while(1) {
             $loop->loop_once();
          }

See Also