Data-Deque-Shared

 view release on metacpan or  search on metacpan

xt/signal_during_wait.t  view on Meta::CPAN

use Test::More;
use POSIX qw(_exit);
use Time::HiRes qw(time);
use Data::Deque::Shared;

plan skip_all => 'AUTHOR_TESTING not set' unless $ENV{AUTHOR_TESTING};

# A SIGUSR1 while a process is parked in pop_wait must cleanly interrupt
# the futex, re-check the predicate, and (since no data arrived) continue
# waiting for the FULL remaining window. Wall-time assertion: total time
# spent blocked ≈ timeout, not just up-to-signal-arrival.

my $s = Data::Deque::Shared::Int->new(undef, 4);
my $TIMEOUT = 2.0;

pipe(my $rd, my $wr) or die $!;
my $pid = fork // die;
if ($pid == 0) {
    close $rd;
    local $SIG{USR1} = sub { };   # install handler (EINTR)
    my $t0 = time;



( run in 1.782 second using v1.01-cache-2.11-cpan-2398b32b56e )