1AnyEvent::Impl::Glib(3)User Contributed Perl DocumentatioAnnyEvent::Impl::Glib(3)
2
3
4
6 AnyEvent::Impl::Glib - AnyEvent adaptor for Glib
7
9 use AnyEvent;
10 use Glib;
11
12 # this module gets loaded automatically as required
13
15 This module provides transparent support for AnyEvent. You don't have
16 to do anything to make Glib work with AnyEvent except by loading Glib
17 before creating the first AnyEvent watcher.
18
19 Glib is probably the most inefficient event loop that has ever seen the
20 light of the world: Glib not only scans all its watchers (really, ALL
21 of them, whether I/O-related, timer-related or what not) during each
22 loop iteration, it also does so multiple times and rebuilds the poll
23 list for the kernel each time again, dynamically even. Newer versions
24 of libglib fortunately do not call malloc/free on every single watcher
25 invocation, though.
26
27 Glib also enforces certain undocumented behaviours, for example, you
28 cannot always remove active child watchers, and the conditions on when
29 it is valid to do so are not documented. Of course, if you get it
30 wrong, you get "GLib-CRITICAL" messages. This makes it extremely hard
31 to write "correct" glib programs, as you have to study the source code
32 to get it right, and hope future versions don't change any internals.
33
34 AnyEvent implements the necessary workarounds, at a small performance
35 cost.
36
37 On the positive side, and most importantly, when it works, Glib
38 generally works correctly, no quarrels there.
39
40 If you create many watchers (as in: more than two), you might consider
41 one of the Glib::EV, EV::Glib or Glib::Event modules that map Glib to
42 other, more efficient, event loops.
43
44 This module uses the default Glib main context for all its watchers.
45
47 AnyEvent, Glib.
48
50 Marc Lehmann <schmorp@schmorp.de>
51 http://anyevent.schmorp.de
52
53
54
55perl v5.28.1 2014-08-28 AnyEvent::Impl::Glib(3)