blib/lib/Acme/Parataxis/Sync.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 31 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use v5.40;
2 no warnings qw[experimental::class recursion];
3 use feature 'class';
4 class Acme::Parataxis::Sync v0.1.6 {
5 use Acme::Parataxis;
6 use Carp qw[croak];
7  
8 # Base class for the synchronization-primitive family (Mutex, WaitGroup, Barrier, Once).
9 # Shared plumbing: resolving the current fiber id, parking with a wake deregistration, and waking a parked fiber.
10 method _fid ($what) {
11 my $fid = Acme::Parataxis->current_fid;
12 croak $what if $fid < 0;
13 return $fid;
14 }
15  
16 # Park the current fiber on this primitive. $dereg unregisters the waiter when the park is interrupted, so a
17 # cancelled wait never leaves a stale id that a later wake could fire at a reused fiber. Level 2 attributes the
18 # wait_reason to the caller of the subclass method (one frame down from here).
19 method _park ( $reason, $dereg = undef ) { Acme::Parataxis::_park( $reason, 2, $dereg ) }
20  
21 # Wake one waiter via the scheduler, skipping ids whose fiber has gone away.
22 method _wake ($waiter) { Acme::Parataxis::_scheduler_enqueue_by_id($waiter) if defined Acme::Parataxis->by_id($waiter) }
23 };
24 #
25 1;