Async-Event-Interval

 view release on metacpan or  search on metacpan

t/07-shm_lock.t  view on Meta::CPAN

    is
        $child_lock,
        $parent_lock,
        "forked child inherits the parent's _shm_lock() (captured at module load)";

    cmp_ok $child_lock, '>',  0;
    cmp_ok $child_lock, '<=', 32767;
}

# A second process started fresh (not via fork) generates its own lock
# value based on its own $$. We can verify the formula by simulating
# what such a process would compute.

{
    my $other_pid       = ($$ + 1) % (1 << 16);  # arbitrary different PID
    my $other_lock      = 1 + ($other_pid % 32767);

    cmp_ok $other_lock, '>',  0,     "fresh-process lock is > 0 for an arbitrary PID";
    cmp_ok $other_lock, '<=', 32767, "fresh-process lock is <= 32767 for an arbitrary PID";
}



( run in 0.893 second using v1.01-cache-2.11-cpan-870870ed90f )