File: 11_deadlock.t

package info (click to toggle)
libcoro-perl 6.570-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,144 kB
  • sloc: ansic: 2,560; perl: 2,122; makefile: 14
file content (45 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
BEGIN {
   if ($^O =~ /mswin32/i) {
      print <<EOF;
1..0 # Perl binary broken, skipping test. Upgrading to a working perl is advised.
EOF
      exit 0;
   }
}

BEGIN { $| = 1; print "1..5\n"; }

use Coro;

print "ok 1\n";

my $pid = fork or do {
   my $old_idle = $Coro::idle;
   $Coro::idle = sub {
      print "ok 2\n";
      close STDERR;
      close STDOUT;
      $old_idle->();
   };
   schedule;
   exit 3;
};

waitpid $pid, 0;
print
   3 == $? >> 8
      ? "not " : "", "ok 3\n";

my $coro = new Coro sub {
   print "ok 5\n";
   Coro::Util::_exit 0;
};

$Coro::idle = sub {
   $coro->ready;
};

print "ok 4\n";

schedule;
die;