Fixing a Perl_my_dirfd() related test failure.
[p5sagit/p5-mst-13.2.git] / ext / Thread / io.tx
CommitLineData
0fcb073c 1BEGIN {
2 eval { require Config; import Config };
3 if ($@) {
4 print "1..0 # Skip: no Config\n";
5 exit(0);
6 }
0fcb073c 7}
8
d9bb3666 9use Thread;
10
17f28c40 11sub counter {
12$count = 10;
13while ($count--) {
14 sleep 1;
15 print "ping $count\n";
16}
17}
18
d9bb3666 19sub reader {
20 my $line;
21 while ($line = <STDIN>) {
22 print "reader: $line";
23 }
24 print "End of input in reader\n";
25 return 0;
26}
27
609f3ea9 28print <<'EOT';
29This test starts up a thread to read and echo whatever is typed on
30the keyboard/stdin, line by line, while the main thread counts down
31to zero. The test stays running until both the main thread has
32finished counting down and the I/O thread has seen end-of-file on
33the terminal/stdin.
34EOT
35
17f28c40 36$r = new Thread \&counter;
37
38&reader;
39
40__END__
41
42
609f3ea9 43$count = 10;
d9bb3666 44while ($count--) {
45 sleep 1;
46 print "ping $count\n";
47}