MCE::Ch...utexFast(3)

πŸ’– NAME πŸ’–

MCE::Channel::MutexFast β€” a fast channel for producer(s) and many consumers ✨


🌸 VERSION 🌸

This doc describes MCE::Channel::MutexFast version 1.902, bestie πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: a channel class that gives you queue-like and two-way communication for processes and threads 🫢 All the locking? Handled for you using MCE::Mutex. No manual mutex wrangling, we love to see it.

This one is basically MCE::Channel::Mutex's cooler sibling, but optimized for non-Unicode strings only πŸ’› The main glow-up difference: this module has no freeze-thaw serialization. Which means non-string arguments get stringified β€” yes, numbers and undef too, they're getting dragged into string form, no cap πŸ™ˆ

The API is described over in MCE::Channel, with the sole difference being that send and send2 handle one argument. That's it, that's the whole tea β˜•

Current module available since MCE 1.877 πŸ‘‘

✨ new ✨

use MCE::Channel;

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

# 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 => 'MutexFast', mp => 1 );
Bestie listen β€” the default is tuned for one producer and many consumers. If you've got two or more producers sending or receiving on the left side of the channel (that's ->enqueue/->send or ->recv2/->recv2_nb), you need to pass mp => 1 for safe use. Don't skip it, fr fr πŸ’€

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

The classic queue vibes, main character energy:

  • enqueue
  • dequeue
  • dequeue_nb
  • end

🌈 TWO-WAY IPC - PRODUCER TO CONSUMER 🌈

Producer yaps, consumer listens πŸ’¬:

  • send
  • recv
  • recv_nb

πŸ“ TWO-WAY IPC - CONSUMER TO PRODUCER πŸ“

And now the consumer talks back, iconic behavior honestly:

  • send2
  • recv2
  • recv2_nb

πŸ‘‘ AUTHOR πŸ‘‘

Mario E. Roy, <marioeroy AT gmail DOT com> πŸ’œ


That's the whole page, bestie β€” you ate that πŸ’…βœ¨ This doc came from the User Contributed Perl Documentation pages, perl v5.42.0, dated 2025-09-10, filed under MCE::Ch...utexFast(3). Go forth and channel your little heart out πŸ¦‹πŸ’–

πŸ“¦ where this page comes from