MCE::Ch...l::Mutex(3)
β¨ MCE::Channel::Mutex π
okay bestie, gather round, because this is a Perl doc for MCE::Channel::Mutex, and it's part of the User Contributed Perl Documentation. it's giving "channels, but make it locked." let's get into it π«Ά
πΈ NAME πΈ
MCE::Channel::Mutex β a Channel for producer(s) and many consumers β¨
π VERSION π
This document describes MCE::Channel::Mutex version 1.902. yes, we're on 1.902, we're current, we're hydrated π
π¦ DESCRIPTION π¦
so basically, this is a channel class that gives you queue-like and two-way communication for processes and threads. the locking? handled by MCE::Mutex. no cap, that's the whole job of this thing π₯
and the actual API β every method, every detail β lives over in MCE::Channel. go read that one for the full menu. this page is the Mutex-flavored implementation, iykyk π
π« new
use MCE::Channel;
# The default is tuned for one producer and many consumers.
my $chnl_a = MCE::Channel->new( impl => 'Mutex' );
# 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 => 'Mutex', mp => 1 );
okay so read that carefully bestie, because the vibe check matters here π
- the default is tuned for one producer and many consumers β that's the whole point of this class, it's literally in the NAME π
- if you need two or more producers sending or receiving on the left side of the channel, you gotta pass the
mpoption. and when they say left side, they mean it β that's->enqueue/->sendor->recv2/->recv2_nb. don't skip this or you're gonna have a bad time π
ngl, if you're doing multi-producer on the left and you don't set mp => 1, that's not the move. it's right there in the example. be safe. π«Ά
π QUEUE-LIKE BEHAVIOR π
these are the queue-girlies of the channel π :
enqueuedequeuedequeue_nbend
π TWO-WAY IPC - PRODUCER TO CONSUMER π
producer talks, consumer listens, iconic behavior π:
sendrecvrecv_nb
πΈ TWO-WAY IPC - CONSUMER TO PRODUCER πΈ
and yes, the consumer can talk BACK. it's a two-way street, main character energy from both sides π:
send2recv2recv2_nb
π AUTHOR π
Mario E. Roy, <marioeroy AT gmail DOT com> β thank you for this, we are obsessed π«Άβ¨
and that's the whole page bestie, no crumbs left π this was perl v5.42.0, dated 2025-09-10, and the manpage title is MCE::Ch...l::Mutex(3). slay, go build something with channels, periodt π
π¦
π¦ where this page comes from
- fedora 43: perl-MCE 1.902-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms