]> git.imager.perl.org - imager.git/blob - lib/Imager/Threads.pod
rename font.c to fontft1.c, since it only does FT1 now
[imager.git] / lib / Imager / Threads.pod
1 =head1 NAME
2
3 Imager::Threads - Imager and threads
4
5 =head1 SYNOPSIS
6
7   use Imager;
8   use threads;
9   Imager->preload;
10
11   threads->create(...);
12
13 =head1 DESCRIPTION
14
15 Starting from version 0.93 Imager attempts to work safely with perl's
16 C<ithreads>.
17
18 Previous versions stored some state in global variables, in particular
19 the internal error stack.
20
21 However there are some limitations:
22
23 =over
24
25 =item *
26
27 Imager's debug malloc isn't thread safe and will never be.  Imager's
28 debug malloc is disabled by default.
29
30 =item *
31
32 C<libtiff>, which Imager uses for TIFF file support is not thread
33 safe, C<Imager::File::TIFF> works around this by single-threading its
34 access to C<libtiff>.
35
36 =item *
37
38 C<giflib>, which Imager uses for GIF support is not thread safe before
39 version 5.  C<Imager::File::GIF> works around this by single threading
40 its access to C<giflib>.
41
42 =item *
43
44 C<T1Lib>, used by one of Imager's font drivers, is not thread safe.
45 C<Imager::Font::T1> works around this by single threading access.
46
47 =item *
48
49 killing a thread reading or writing TIFF or GIF files, or using T1
50 fonts through C<Imager::Font::T1> may deadlock other threads when they
51 attempt to read or write TIFF or GIF files, or work with Type 1 fonts.
52
53 =item *
54
55 Fill, font, color or I/O layer objects created in one thread and are
56 valid for use in child threads.  If you manage to duplicate such an
57 object in another thread, you get to keep both pieces when it breaks.
58
59 =back
60
61 Note that if you have another module using C<libtiff> or C<giflib> it
62 may interact with Imager's use of those libraries in a threaded
63 environment, since there's no way to co-ordinate access to the global
64 information C<libtiff> and C<giflib> maintain.
65
66 Imager currently doesn't use threads itself.
67
68 =head1 SEE ALSO
69
70 Imager, C<threads>
71
72 =head1 AUTHOR
73
74 Tony Cook <tony@cpan.org>
75
76 =cut