MCE::Ch...:Threads(3)

πŸ’– MCE::Channel::Threads(3) β€” the manual page, bestie edition πŸ’–

okay so this is the user-contributed Perl documentation for MCE::Channel::Threads, and I'm gonna walk you through it like we're texting at 1am. buckle up πŸŽ€


✨ NAME ✨

MCE::Channel::Threads β€” a Channel for producer(s) and many consumers. it's giving assembly line but make it threads 🧡


🌸 VERSION 🌸

This document describes MCE::Channel::Threads version 1.902. yes, the version number is exact, don't @ me πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So basically, this is a channel class that gives you queue-like and two-way communication, but for threads only. no processes allowed at this party πŸ™ˆ

Locking? handled using threads::shared. she does her own security, iconic behavior honestly πŸ‘‘

The API is described in MCE::Channel β€” go read that for the full tea.

πŸ’œ new

use MCE::Channel;

# The default is tuned for one producer and many consumers.
my $chnl_a = MCE::Channel->new( impl => 'Threads' );

# Specify the 'mp' option for safe use by two or more producers
# sending or receiving on the left side of the channel (i.e.
# ->enqueue/->send or ->recv2/->recv2_nb).

my $chnl_b = MCE::Channel->new( impl => 'Threads', mp => 1 );

okay so real talk about those comments, because they MATTER:

  • the default setup is tuned for one producer and many consumers. one queen, many loyal subjects ✨
  • but if you've got two or more producers sending or receiving on the left side of the channel, you gotta pass mp => 1. and by "left side" we mean ->enqueue / ->send or ->recv2 / ->recv2_nb. do not skip this, bestie, it's the safety rail 🫢

πŸŽ€ QUEUE-LIKE BEHAVIOR πŸŽ€

these are the queue-girlies, in order:

  • enqueue
  • dequeue
  • dequeue_nb
  • end

πŸ”₯ TWO-WAY IPC - PRODUCER TO CONSUMER πŸ”₯

the producer-to-consumer pipeline, main character energy:

  • send
  • recv
  • recv_nb

🌈 TWO-WAY IPC - CONSUMER TO PRODUCER 🌈

and the reply lane, consumer hitting back:

  • send2
  • recv2
  • recv2_nb

πŸ’€ LIMITATIONS πŸ’€

okay here's the part where we gotta be real. the t/04_channel_threads tests are disabled on Unix platforms for Perl less than 5.10.1. basically, the MCE::Channel::Threads implementation is not supported on older Perls unless the OS vendor applied upstream patches. (like, it works on RedHat/CentOS 5.x running Perl 5.8.x. yes, for real. vintage behavior πŸ“)

lowkey important: older Perl = no support unless patched upstream. that's the whole vibe. no cap.

πŸ‘‘ AUTHOR πŸ‘‘

Mario E. Roy, <marioeroy AT gmail DOT com> β€” the icon, the legend, the one who wrote this ✨


that's the whole page bestie, you understood it perfectly, slay πŸ’…

this was perl v5.42.0, dated 2025-09-10, straight from MCE::Ch...:Threads(3) β€” see you in the next manpage, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from