Imager::Threads(3pm)

🌸 NAME 🌸

Okay so this is Imager::Threads(3pm), a User Contributed Perl Documentation page for Imager::Threads β€” and the name is literally Imager and threads. That's the whole assignment, bestie. 🫢

πŸŽ€ SYNOPSIS πŸŽ€

Here's the synopsis, and yes, copy it exactly:

use Imager;
use threads;
Imager->preload;

threads->create(...);

πŸ¦‹ DESCRIPTION πŸ¦‹

Starting from version 0.94, Imager tries to work safely with perl's ithreads. No cap, that's the goal. ✨

Previous versions stored some state in global variables β€” in particular, the internal error stack. That's the backstory. πŸ‘€

However there are some limitations:

  • Imager's debug malloc isn't thread safe and will never be. Imager's debug malloc is disabled by default. πŸ’…
  • libtiff β€” which Imager uses for TIFF file support β€” is not thread safe. Imager::File::TIFF works around this by single-threading its access to libtiff.
  • giflib β€” which Imager uses for GIF support β€” is not thread safe before version 5. Imager::File::GIF works around this by single threading its access to giflib.
  • T1Lib, used by one of Imager's font drivers, is not thread safe. Imager::Font::T1 works around this by single threading access.
  • killing a thread reading or writing TIFF or GIF files, or using T1 fonts through Imager::Font::T1, may deadlock other threads when they attempt to read or write TIFF or GIF files, or work with Type 1 fonts. That's the deadlock jump-scare, bestie. 😭
  • Fill, font, color or I/O layer objects created in one thread are not valid for use in child threads. If you manage to duplicate such an object in another thread, you get to keep both pieces when it breaks. πŸ’€
Heads up: if you have another module using libtiff, giflib or t1lib, it may interact with Imager's use of those libraries in a threaded environment, since there's no way to co-ordinate access to the global information libtiff, giflib and t1lib maintain. iykyk, global state is messy.

Imager currently doesn't use threads itself, except for testing its threads support. So it's not starting thread drama on its own. 🧚

πŸ’œ SEE ALSO πŸ’œ

Go peep Imager and "threads". That's the squad. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Tony Cook <tony@cpan.org> β€” author, main character energy. πŸ’–

That's the page, bestie! This one came from perl v5.42.3, dated 2026-08-19, and it's Imager::Threads(3pm). Bye, go thread responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from