Data-Queue-Shared
view release on metacpan or search on metacpan
bench/contention.pl view on Meta::CPAN
waitpid($_, 0) for @prod_pids, @cons_pids;
print rate_fmt("Shared::Str (futex blocking, 50B)", time - $t0, $total), "\n";
}
# ----------------------------------------------------------------
# MCE::Queue (concurrent produce+consume via MCE task groups)
# ----------------------------------------------------------------
if ($has_mce) {
require MCE;
# MCE::Step runs task groups concurrently with transparent queue plumbing.
# task_end + $q->end() is the documented pattern for producer/consumer.
# MCE::Queue uses socket IPC routed through the manager process.
# True concurrent MPMC (N producers + N consumers) is not a supported
# MCE pattern â it's designed for workersâmanager or pipeline flows.
# See bench/vs.pl for MCE single-process and produceâdrain comparisons.
print " (MCE::Queue: no concurrent MPMC â see bench/vs.pl)\n";
}
# ----------------------------------------------------------------
# Scaling: vary producer/consumer counts
xt/eintr_sigalrm.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use POSIX ();
use Time::HiRes qw(time);
# SIGALRM during futex-based pop_wait: the syscall may return EINTR; the
# wrapper must either retry transparently or surface a clean error, and
# must not leave waiters deadlocked.
use Data::Queue::Shared::Int;
my $q = Data::Queue::Shared::Int->new_memfd("eintr", 4);
# Arrange SIGALRM to fire ~100ms into a 500ms wait.
my $got_alrm = 0;
local $SIG{ALRM} = sub { $got_alrm++ };
( run in 1.515 second using v1.01-cache-2.11-cpan-39bf76dae61 )