Perl::...hreads(3pm)

πŸ“¦
version 1.0.4 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Perl::Critic::Policy::Community::Threads β€” the manual page formerly known as Perl::...hreads(3pm) πŸ’–

okay bestie, welcome to the Perl::Critic::Policy::Community::Threads page. yes the header is giving "my name got cut off in the terminal" β€” it's Perl::...hreads(3pm) and honestly? iconic of it to be so dramatic. let's get into it. 🫢


✨ NAME ✨

Perl::Critic::Policy::Community::Threads β€” interpreter-based threads are officially discouraged

like, not me being a policy whose whole job is to gently drag interpreter threads. it's not personal, it's just the facts. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Perl interpreter threads are officially discouraged. periodt. that's the whole vibe.

the way that they came to exist is that they were created to emulate fork() in Windows environments β€” which, okay, valid, we needed something. but here's the tea: they are not fast and not lightweight the way one may expect. like, the name said "threads" and you thought "ooooh cute lightweight concurrency" and it's giving... not that. 😭

so what's a girl to do instead? depends on your code, bestie:

  • Non-blocking code or I/O can be easily parallelized by using an event loop such as POE, IO::Async, or Mojo::IOLoop. ✨
  • Blocking code is usually better parallelized by forking, which on Unix-like systems is fast and efficient. no cap. 🌸

and if forking sounds scary, don't worry, there's help:

  • Modules such as forks and Parallel::Prefork can make forking easier to work with. πŸŽ€
  • There are also forking modules for event loops, such as POE::Wheel::Run, IO::Async::Process, or "subprocess" in Mojo::IOLoop. πŸ”₯

so like... fork, or event loop, or both, just maybe not interpreter threads, iykyk. πŸ’€


πŸ‘‘ AFFILIATION πŸ‘‘

This policy is part of Perl::Critic::Community. it's a community thing, we're all fam here. πŸ’œ


πŸŽ€ CONFIGURATION πŸŽ€

This policy is not configurable except for the standard options.

that's it. that's the whole config section. she's low maintenance. πŸ™ˆ


⭐ AUTHOR ⭐

Dan Book, dbook@cpan.org

thank you Dan, legend behavior fr fr. 🫢


Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.

(so like, go off, remix it, redistribute it, just respect the license bestie πŸ’–)


🌸 SEE ALSO 🌸

  • Perl::Critic

and that's the page!! perl v5.40.1, dated 2025-03-22, mwah πŸ’…βœ¨ keep your code parallel, keep your threads interpreter-free, and stay slay. πŸ¦‹πŸ“

πŸ“¦ where this page comes from