Async/Transport.pm

filter: Statementstmt 80.1% 113 / 141 Branchbran 59.0% 39 / 66 Conditioncond 67.3% 33 / 49 MC/DCmcdc 48.1% 13 / 27 Subroutinesub 87.5% 21 / 24 Podpod 100% 3 / 3 totaltotal 71.6% 222 / 310 CC 53 SCAR 19.8
CC
53
Cov
72%
_launch
16.5
_maybe_finish
13.6
new
8.3
CRAP 7.3
↑ Summary Async/Server.pm »
1 package LibTmux::Async::Transport;
2 3 ▶use v5.44;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use Future;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use IO::Async::Loop::Ppoll 0.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use IO::Ppoll 0.14 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use IO::Async::Stream;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use POSIX qw(SIG_UNBLOCK SIGCHLD);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use LibTmux::ProcessJob;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use LibTmux::Async::X;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 34 ▶sub _validate_loop ($loop) {
Subroutine _validate_loop: called CC=6 SCAR=17.9
12  
13 # Ppoll 0.10 stores the configured wait object here; its public constructor
14 # also accepts plain IO::Poll, which cannot deliver CHLD atomically.
15 LibTmux::X::Unsupported->throw(
16 message =>
17 'use IO::Async::Loop::Ppoll with IO::Ppoll and a wait mask permitting SIGCHLD',
18 dispatched => false,
19 )
20 unless ref($loop) eq 'IO::Async::Loop::Ppoll'
21 && reftype($loop) eq 'HASH'
22 && ref($loop->{poll}) eq 'IO::Ppoll'
23 && reftype($loop->{poll}) eq 'HASH'
24 34 ▶ && !$loop->{poll}->sigmask_ismember(SIGCHLD);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $loop eq "IO::Async::Loop::Ppoll" and builtin::reftype($loop) eq "HASH" and ref $loop->{"poll"} eq "IO::Ppoll" and builtin::reftype($loop->{"poll"}) eq "HASH" and not $loop->{"poll"}->sigmask_ismember(17) 5 29 34
Condition91%11/12
ref $loop eq "IO::Async::Loop::Ppoll" and builtin::reftype($loop) eq "HASH" and ref $loop->{"poll"} eq "IO::Ppoll" and builtin::reftype($loop->{"poll"}) eq "HASH" and not $loop->{"poll"}->sigmask_ismember(17)
!ll&&!rl&&r
3229
ref $loop eq "IO::Async::Loop::Ppoll" and builtin::reftype($loop) eq "HASH" and ref $loop->{"poll"} eq "IO::Ppoll" and builtin::reftype($loop->{"poll"}) eq "HASH"
!ll&&!rl&&r
3031
ref $loop eq "IO::Async::Loop::Ppoll" and builtin::reftype($loop) eq "HASH" and ref $loop->{"poll"} eq "IO::Ppoll"
!ll&&!rl&&r
2131
ref $loop eq "IO::Async::Loop::Ppoll" and builtin::reftype($loop) eq "HASH"
!ll&&!rl&&r
1132
MC/DC80%4/5
ref $loop eq "IO::Async::Loop::Ppoll" and builtin::reftype($loop) eq "HASH" and ref $loop->{"poll"} eq "IO::Ppoll" and builtin::reftype($loop->{"poll"}) eq "HASH" and not $loop->{"poll"}->sigmask_ismember(17)
ref $loop eq "IO::Async::Loop::Ppoll" builtin::reftype($loop) eq "HASH" ref $loop->{"poll"} eq "IO::Ppoll" builtin::reftype($loop->{"poll"}) eq "HASH" not $loop->{"poll"}->sigmask_ismember(17)
Truth table83%5/6
A and B and C and D and not(E)
A= ref $loop eq "IO::Async::Loop::Ppoll"B= builtin::reftype($loop) eq "HASH"C= ref $loop->{"poll"} eq "IO::Ppoll"D= builtin::reftype($loop->{"poll"}) eq "HASH"E= not $loop->{"poll"}->sigmask_ismember(17)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
25 }
26  
27 0 ▶sub _prepare_child () {
Subroutine _prepare_child: not called CC=2 SCAR=17.9
28 0 ▶ POSIX::sigprocmask(SIG_UNBLOCK, POSIX::SigSet->new(SIGCHLD))
Branch: 1 branch
BranchTrueFalseTotal
POSIX::sigprocmask(1, "POSIX::SigSet"->new(17)) or 0 0 0
29 or LibTmux::X::Transport->throw(
30 message => "unblock async child SIGCHLD: $!",
31 dispatched => false
32 );
33 }
34  
35 12 ▶sub new ($class, %args) {
Subroutine new: called CC=7 SCAR=21.2
Pod documented
36 LibTmux::X::InvalidArgument->throw(
37 message => 'an explicit IO::Async::Loop is required')
38 12 ▶ unless ref($args{loop}) && $args{loop}->isa('IO::Async::Loop');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"loop"} and $args{"loop"}->isa("IO::Async::Loop") 0 12 12
Condition33%1/3
ref $args{"loop"} and $args{"loop"}->isa("IO::Async::Loop")
!ll&&!rl&&r
0012
MC/DC0%0/2
ref $args{"loop"} and $args{"loop"}->isa("IO::Async::Loop")
ref $args{"loop"} $args{"loop"}->isa("IO::Async::Loop")
Truth table33%1/3
A and B
A= ref $args{"loop"}B= $args{"loop"}->isa("IO::Async::Loop")
ABresult
0X0
100
111
39 12 _validate_loop($args{loop});
40 8 ▶ $args{max_concurrent} //= 4;
Condition100%2/2
$args{"max_concurrent"} //= 4
l!l
35
MC/DC100%1/1
$args{"max_concurrent"} //= 4
$args{"max_concurrent"}
Truth table100%2/2
A
A= $args{"max_concurrent"}
Aresult
11
00
41 8 ▶ $args{max_queue} //= 64;
Condition100%2/2
$args{"max_queue"} //= 64
l!l
35
MC/DC100%1/1
$args{"max_queue"} //= 64
$args{"max_queue"}
Truth table100%2/2
A
A= $args{"max_queue"}
Aresult
11
00
42 8 ▶ LibTmux::X::InvalidArgument->throw(message =>
Branch: 1 branch
BranchTrueFalseTotal
unless qq[$args{"max_concurrent"}] =~ /\A[1-9][0-9]*\z/u and qq[$args{"max_queue"}] =~ /\A[0-9]+\z/u 0 8 8
Condition33%1/3
qq[$args{"max_concurrent"}] =~ /\A[1-9][0-9]*\z/u and qq[$args{"max_queue"}] =~ /\A[0-9]+\z/u
!ll&&!rl&&r
008
MC/DC0%0/2
qq[$args{"max_concurrent"}] =~ /\A[1-9][0-9]*\z/u and qq[$args{"max_queue"}] =~ /\A[0-9]+\z/u
qq[$args{"max_concurrent"}] =~ /\A[1-9][0-9]*\z/u qq[$args{"max_queue"}] =~ /\A[0-9]+\z/u
Truth table33%1/3
A and B
A= qq[$args{"max_concurrent"}] =~ /\A[1-9][0-9]*\z/uB= qq[$args{"max_queue"}] =~ /\A[0-9]+\z/u
ABresult
0X0
100
111
43 'max_concurrent must be positive and max_queue nonnegative integers'
44 )
45 unless "$args{max_concurrent}" =~ /\A[1-9][0-9]*\z/
46 && "$args{max_queue}" =~ /\A[0-9]+\z/;
47 return bless {
48 loop => $args{loop},
49 max_concurrent => $args{max_concurrent},
50 max_queue => $args{max_queue},
51 jobs => {},
52 queue => [],
53 next_id => 0,
54 closing => false,
55 cleanup => $args{loop}->new_future,
56 8 cleanup_errors => []
57 }, $class;
58 }
59  
60 13 ▶sub execute ($self, %request) {
Subroutine execute: called CC=8 SCAR=21.0
Pod documented
61 13 my $future = $self->{loop}->new_future;
62 13 ▶ if ($self->{closing}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"closing"}) 1 12 13
63 1 return $future->fail(
64 LibTmux::Async::X::Closed->new(message => 'transport is closing'));
65 }
66 12 my $copy;
67 12 try {
68 12 _validate_loop($self->{loop});
69 LibTmux::X::InvalidArgument->throw(
70 message => 'argv must be a nonempty array')
71 11 ▶ unless ref($request{argv}) eq 'ARRAY' && $request{argv}->@*;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $request{"argv"} eq "ARRAY" and @{$request{"argv"}} 0 11 11
Condition33%1/3
ref $request{"argv"} eq "ARRAY" and @{$request{"argv"}}
!ll&&!rl&&r
0011
MC/DC0%0/2
ref $request{"argv"} eq "ARRAY" and @{$request{"argv"}}
ref $request{"argv"} eq "ARRAY" @{$request{"argv"}}
Truth table33%1/3
A and B
A= ref $request{"argv"} eq "ARRAY"B= @{$request{"argv"}}
ABresult
0X0
100
111
72 11 $copy = {%request, argv => [$request{argv}->@*]};
73 0 ▶ $copy->{env} = {%{$request{env}}} if exists $request{env};
Branch: 1 branch
BranchTrueFalseTotal
if exists $request{"env"} 0 11 11
74 }
75 1 catch ($error) { return $future->fail($error) }
76 11 my $entry = {id => ++$self->{next_id}, request => $copy, future => $future};
77 11 ▶ $future->on_cancel(sub { $entry->{job}->cancel if $entry->{job} });
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
if $entry->{"job"} 1 0 1
78 11 $self->{queue} = [grep { !$_->{future}->is_ready } $self->{queue}->@*];
79 11 ▶ if (!$self->{queue}->@*
Branch: 1 branch
BranchTrueFalseTotal
if (not @{$self->{'queue'}} and keys %{$$self{'jobs'}} < $self->{'max_concurrent'}) { } 8 3 11
Condition100%3/3
not @{$self->{"queue"}} and keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
!ll&&!rl&&r
128
MC/DC100%2/2
not @{$self->{"queue"}} and keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
not @{$self->{"queue"}} keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
Truth table100%3/3
not(A) and B
A= not @{$self->{"queue"}}B= keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
ABresult
0X0
100
111
80 && keys($self->{jobs}->%*) < $self->{max_concurrent})
81 {
82 8 $self->_launch($entry);
83 }
84 else {
85 3 $self->{queue} = [grep { !$_->{future}->is_ready } $self->{queue}->@*];
86 3 ▶ if ($self->{queue}->@* >= $self->{max_queue}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{'queue'}} >= $self->{'max_queue'}) { } 1 2 3
87 1 $future->fail(
88 LibTmux::Async::X::QueueFull->new(
89 message => 'async request queue is full',
90 dispatched => false
91 )
92 );
93 }
94 2 else { push $self->{queue}->@*, $entry }
95 }
96 11 return $future;
97 }
98  
99 10 ▶sub _launch ($self, $entry) {
Subroutine _launch: called CC=7 SCAR=28.0
100 10 ▶ return if $entry->{future}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if $entry->{"future"}->is_ready 0 10 10
101 10 $self->{jobs}{$entry->{id}} = $entry;
102 10 try {
103 10 _validate_loop($self->{loop});
104 my $job = LibTmux::ProcessJob->start(
105 $entry->{request}->%*,
106 10 ▶ spawner => sub ($code) {
Subroutine __ANON__: called CC=1 SCAR=0.1
107 $self->{loop}->fork(
108 0 ▶ code => sub { $code->(\&_prepare_child) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
109 10 ▶ on_exit => sub ($pid, $status) {
Subroutine __ANON__: called CC=1 SCAR=0.0
110 10 $entry->{exit_seen} = true;
111 10 $entry->{exit_status} = $status;
112 10 $self->_maybe_finish($entry);
113 }
114 10 );
115 }
116 10 );
117 10 $entry->{job} = $job;
118 10 $entry->{reader} = $job->take_result_handle;
119 my $stream = IO::Async::Stream->new(
120 read_handle => $entry->{reader},
121 20 ▶ on_read => sub ($stream, $buffer, $eof) {
Subroutine __ANON__: called CC=3 SCAR=11.3
122 20 ▶ unless ($entry->{error}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($entry->{"error"}) 20 0 20
123 20 try { $job->consume($$buffer) }
124 0 catch ($error) { $entry->{error} = $error; $job->cancel }
125 }
126 20 $$buffer = '';
127 20 ▶ if ($eof) { $entry->{eof} = true; $self->_maybe_finish($entry) }
Branch: 1 branch
BranchTrueFalseTotal
if ($eof) 10 10 20
128 20 return 0;
129 },
130 0 ▶ on_read_error => sub ($stream, $errno) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
131 0 $entry->{error} = LibTmux::X::Transport->new(
132 message => "read async result: $errno",
133 dispatched => true
134 );
135 0 $job->cancel;
136 0 $stream->close_now;
137 0 ▶ $self->{loop}->remove($stream) if $stream->loop;
Branch: 1 branch
BranchTrueFalseTotal
if $stream->loop 0 0 0
138 0 $entry->{eof} = true;
139 0 $self->_maybe_finish($entry);
140 },
141 10 );
142 10 $entry->{stream} = $stream;
143 10 delete $entry->{reader};
144 10 $self->{loop}->add($stream);
145 }
146 catch ($error) {
147 0 ▶ if ($entry->{job}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry->{'job'}) { } 0 0 0
148 0 $entry->{error} = $error;
149 0 $entry->{job}->cancel;
150 0 ▶ if (my $stream = $entry->{stream}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $stream = $entry->{'stream'}) { } 0 0 0
151 0 $stream->close_now;
152 0 ▶ $self->{loop}->remove($stream) if $stream->loop;
Branch: 1 branch
BranchTrueFalseTotal
if $stream->loop 0 0 0
153 }
154 else {
155 0 my $handle = delete $entry->{reader};
156 0 ▶ close $handle if $handle;
Branch: 1 branch
BranchTrueFalseTotal
if $handle 0 0 0
157 }
158 0 $entry->{eof} = true;
159 0 $self->_maybe_finish($entry);
160 }
161 else {
162 0 delete $self->{jobs}{$entry->{id}};
163 0 ▶ $entry->{future}->fail($error) unless $entry->{future}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $entry->{"future"}->is_ready 0 0 0
164 0 $self->_drain;
165 0 $self->_check_close;
166 }
167 }
168 }
169  
170 20 ▶sub _maybe_finish ($self, $entry) {
Subroutine _maybe_finish: called CC=11 SCAR=26.1
171 20 ▶ return if $entry->{terminal} || !$entry->{eof} || !$entry->{exit_seen};
Branch: 1 branch
BranchTrueFalseTotal
if $entry->{"terminal"} or not $entry->{"eof"} or not $entry->{"exit_seen"} 10 10 20
Condition50%3/6
$entry->{"terminal"} or not $entry->{"eof"} or not $entry->{"exit_seen"}
l!l&&r!l&&!r
01010
$entry->{"terminal"} or not $entry->{"eof"}
l!l&&r!l&&!r
0020
MC/DC33%1/3
$entry->{"terminal"} or not $entry->{"eof"} or not $entry->{"exit_seen"}
$entry->{"terminal"} not $entry->{"eof"} not $entry->{"exit_seen"}
Truth table50%2/4
A or not(B) or not(C)
A= $entry->{"terminal"}B= not $entry->{"eof"}C= not $entry->{"exit_seen"}
ABCresult
1XX1
01X1
0011
0000
172 10 $entry->{terminal} = true;
173 10 my ($result, $error) = (undef, $entry->{error});
174 10 try { $result = $entry->{job}->finish }
175 3 ▶ catch ($caught) { $error //= $caught }
Condition33%1/3
$error //= $caught
l!l&&r!l&&!r
030
MC/DC0%0/2
$error //= $caught
$error $caught
Truth table33%1/3
A //= B
A= $errorB= $caught
ABresult
1X1
011
000
176 10 ▶ if (!$entry->{job}->cleanup_complete) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($entry->{"job"}->cleanup_complete) 0 10 10
177 push $self->{cleanup_errors}->@*,
178 0 ▶ $error // LibTmux::X::Transport->new(
Condition0%0/3
$error //
l!l&&r!l&&!r
000
MC/DC0%0/2
$error //
$error
Truth table0%0/3
A // B
A= $errorB=
ABresult
1X1
011
000
179 message => 'supervisor exit did not prove program cleanup',
180 dispatched => true
181 );
182 }
183 10 ▶ if (my $stream = delete $entry->{stream}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $stream = delete $entry->{"stream"}) 10 0 10
184 10 $stream->close_now;
185 10 ▶ $self->{loop}->remove($stream) if $stream->loop;
Branch: 1 branch
BranchTrueFalseTotal
if $stream->loop 0 10 10
186 }
187 10 delete $self->{jobs}{$entry->{id}};
188 10 ▶ unless ($entry->{future}->is_ready) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($entry->{"future"}->is_ready) 9 1 10
189 9 ▶ if ($error) { $entry->{future}->fail($error) }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) { } 2 7 9
190 7 else { $entry->{future}->done($result) }
191 }
192 10 delete $entry->{job};
193 10 $self->_drain;
194 10 $self->_check_close;
195 }
196  
197 10 ▶sub _drain ($self) {
Subroutine _drain: called CC=5 SCAR=16.1
198 10 ▶ return if $self->{closing};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"closing"} 1 9 10
199 9 ▶ while ($self->{queue}->@*
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{"queue"}} and keys %{$$self{"jobs"}} < $self->{"max_concurrent"}) 2 9 11
Condition100%3/3
@{$self->{"queue"}} and keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
!ll&&!rl&&r
812
MC/DC100%2/2
@{$self->{"queue"}} and keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
@{$self->{"queue"}} keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
Truth table100%3/3
A and B
A= @{$self->{"queue"}}B= keys %{$$self{"jobs"}} < $self->{"max_concurrent"}
ABresult
0X0
100
111
200 && keys($self->{jobs}->%*) < $self->{max_concurrent})
201 {
202 2 my $entry = shift $self->{queue}->@*;
203 2 ▶ $self->_launch($entry) unless $entry->{future}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $entry->{"future"}->is_ready 2 0 2
204 }
205 }
206  
207 19 ▶sub _check_close ($self) {
Subroutine _check_close: called CC=5 SCAR=16.6
208 return
209 unless $self->{closing}
210 && !keys($self->{jobs}->%*)
211 19 ▶ && !$self->{cleanup}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"closing"} and not keys %{$$self{"jobs"}} and not $self->{"cleanup"}->is_ready 11 8 19
Condition83%5/6
$self->{"closing"} and not keys %{$$self{"jobs"}} and not $self->{"cleanup"}->is_ready
!ll&&!rl&&r
1108
$self->{"closing"} and not keys %{$$self{"jobs"}}
!ll&&!rl&&r
928
MC/DC66%2/3
$self->{"closing"} and not keys %{$$self{"jobs"}} and not $self->{"cleanup"}->is_ready
$self->{"closing"} not keys %{$$self{"jobs"}} not $self->{"cleanup"}->is_ready
Truth table75%3/4
A and not(B) and not(C)
A= $self->{"closing"}B= not keys %{$$self{"jobs"}}C= not $self->{"cleanup"}->is_ready
ABCresult
0XX0
10X0
1100
1111
212 8 ▶ if ($self->{cleanup_errors}->@*) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{'cleanup_errors'}}) { } 0 8 8
213 0 $self->{cleanup}->fail($self->{cleanup_errors}[0]);
214 }
215 8 else { $self->{cleanup}->done(undef) }
216 }
217  
218 9 ▶sub close ($self) {
Subroutine close: called CC=4 SCAR=13.9
Pod documented
219 9 ▶ unless ($self->{closing}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"closing"}) 8 1 9
220 8 $self->{closing} = true;
221 8 my @queued = splice $self->{queue}->@*;
222 8 $_->{future}->cancel for @queued;
223 8 $_->{future}->cancel for values $self->{jobs}->%*;
224 }
225 9 $self->_check_close;
226 9 my $observer = $self->{loop}->new_future;
227 $self->{cleanup}->on_ready(
228 9 ▶ sub ($private) {
Subroutine __ANON__: called CC=3 SCAR=11.4
229 9 ▶ return if $observer->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if $observer->is_ready 1 8 9
230 8 ▶ if ($private->is_done) { $observer->done(undef) }
Branch: 1 branch
BranchTrueFalseTotal
if ($private->is_done) { } 8 0 8
231 0 else { $observer->fail(scalar $private->failure) }
232 }
233 9 );
234 9 return $observer;
235 }
236  
237 =head1 NAME
238  
239 LibTmux::Async::Transport - Bounded asynchronous process execution
240  
241 =head1 METHODS
242  
243 =head2 new
244  
245 C<new(loop =E<gt> $loop, max_concurrent =E<gt> 4, max_queue =E<gt> 64)>
246 borrows an L<IO::Async::Loop::Ppoll> backed by L<IO::Ppoll>. Construct that
247 class explicitly; automatic loop selection can choose an unsupported backend.
248 Other classes, a substituted poll implementation, or a wait mask blocking
249 SIGCHLD throw L<Unsupported|LibTmux::X/Unsupported> before dispatch. The loop
250 owns supervisor reaping; competing external all-child reapers are unsupported.
251 The library never runs, stops, or replaces it.
252  
253 Ppoll blocks watched signals outside its atomic wait. Its shared SIGCHLD watch
254 can outlive this transport. C<close> leaves the caller-selected loop and its
255 signal policy intact. Do not change the backend or its wait mask while jobs
256 or cleanup remain active. Async children unblock only SIGCHLD before process
257 supervision; other mask bits remain unchanged in the child. This lets a new
258 tmux daemon observe pane exits without changing synchronous core's mask policy.
259  
260 =head2 execute
261  
262 Accepts the same literal process arguments as L<LibTmux::Transport/run>.
263 Returns a L<Future> yielding one L<command result|LibTmux::Transport/RESULTS>.
264 Typed core exceptions remain the failure value. Queue overflow fails with
265 L<QueueFull|LibTmux::Async::X/QueueFull> before dispatch.
266 The backend is checked again at admission and launch. Child preparation
267 failures retain a typed diagnostic and C<dispatched> false, with supervisor
268 exit still required before cleanup completes.
269  
270 The shared L<LibTmux::ProcessJob> owns supervision. Cancelling the Future
271 requests cleanup; it does not prove exit or reverse command effects.
272  
273 =head2 close
274  
275 Begin idempotent shutdown and return a fresh observer Future. New admissions
276 fail with L<Closed|LibTmux::Async::X/Closed>; queued requests are cancelled
277 without dispatch and running jobs are cancelled. Cancelling an observer never
278 cancels private cleanup. Only successful C<is_done> completion proves all owned
279 jobs, pipes, and watchers have completed cleanup. The borrowed loop remains
280 usable. Callers must keep driving it through shutdown.
281  
282 =cut
↑ Summary Async/Server.pm »