1Imager::Threads(3) User Contributed Perl Documentation Imager::Threads(3)
2
3
4
6 Imager::Threads - Imager and threads
7
9 use Imager;
10 use threads;
11 Imager->preload;
12
13 threads->create(...);
14
16 Starting from version 0.94 Imager attempts to work safely with perl's
17 "ithreads".
18
19 Previous versions stored some state in global variables, in particular
20 the internal error stack.
21
22 However there are some limitations:
23
24 · Imager's debug malloc isn't thread safe and will never be.
25 Imager's debug malloc is disabled by default.
26
27 · "libtiff", which Imager uses for TIFF file support is not thread
28 safe, "Imager::File::TIFF" works around this by single-threading
29 its access to "libtiff".
30
31 · "giflib", which Imager uses for GIF support is not thread safe
32 before version 5. "Imager::File::GIF" works around this by single
33 threading its access to "giflib".
34
35 · "T1Lib", used by one of Imager's font drivers, is not thread safe.
36 "Imager::Font::T1" works around this by single threading access.
37
38 · killing a thread reading or writing TIFF or GIF files, or using T1
39 fonts through "Imager::Font::T1" may deadlock other threads when
40 they attempt to read or write TIFF or GIF files, or work with Type
41 1 fonts.
42
43 · Fill, font, color or I/O layer objects created in one thread are
44 not valid for use in child threads. If you manage to duplicate
45 such an object in another thread, you get to keep both pieces when
46 it breaks.
47
48 Note that if you have another module using "libtiff", "giflib" or
49 "t1lib" it may interact with Imager's use of those libraries in a
50 threaded environment, since there's no way to co-ordinate access to the
51 global information "libtiff", "giflib" and "t1lib" maintain.
52
53 Imager currently doesn't use threads itself, except for testing its
54 threads support.
55
57 Imager, "threads"
58
60 Tony Cook <tony@cpan.org>
61
62
63
64perl v5.32.0 2020-07-28 Imager::Threads(3)