1AnyEvent::Impl::Tk(3) User Contributed Perl DocumentationAnyEvent::Impl::Tk(3)
2
3
4
6 AnyEvent::Impl::Tk - AnyEvent adaptor for Tk
7
9 use AnyEvent;
10 use Tk;
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 Tk work with AnyEvent except by loading Tk
17 before creating the first AnyEvent watcher.
18
19 Tk is buggy. Tk is extremely buggy. Tk is so unbelievably buggy that
20 for each bug reported and fixed, you get one new bug followed by
21 reintroduction of the old bug in a later revision. It is also basically
22 unmaintained: the maintainers are not even interested in improving the
23 situation - reporting bugs is considered rude, and fixing bugs is
24 considered changing holy code, so it's apparently better to leave it
25 broken.
26
27 I regularly run out of words to describe how bad it really is.
28
29 To work around some of the many, many bugs in Tk that don't get fixed,
30 this adaptor dup()'s all filehandles that get passed into its I/O
31 watchers, so if you register a read and a write watcher for one fh,
32 AnyEvent will create two additional file descriptors (and handles).
33
34 This creates a high overhead and is slow, but seems to work around most
35 known bugs in Tk::fileevent on 32 bit architectures (Tk seems to be
36 terminally broken on 64 bit, do not expect more than 10 or so watchers
37 to work on 64 bit machines).
38
39 Do not expect these workarounds to avoid segfaults and crashes inside
40 Tk.
41
42 Note also that Tk event ids wrap around after 2**32 or so events, which
43 on my machine can happen within less than 12 hours, after which Tk will
44 stomp on random other events and kill them. So don't run Tk programs
45 for more than an hour or so.
46
47 To be able to access the Tk event loop, this module creates a main
48 window and withdraws it immediately. This might cause flickering on
49 some platforms, but Tk perversely requires a window to be able to wait
50 for file handle readyness notifications. This window is always created
51 (in this version of AnyEvent) and can be accessed as
52 $AnyEvent::Impl::Tk::mw.
53
55 AnyEvent, Tk.
56
58 Marc Lehmann <schmorp@schmorp.de>
59 http://anyevent.schmorp.de
60
61
62
63perl v5.38.0 2023-07-20 AnyEvent::Impl::Tk(3)