Commit | Line | Data |
0fcb073c |
1 | BEGIN { |
2 | eval { require Config; import Config }; |
3 | if ($@) { |
4 | print "1..0 # Skip: no Config\n"; |
5 | exit(0); |
6 | } |
0fcb073c |
7 | } |
8 | |
d9bb3666 |
9 | use Thread; |
10 | |
17f28c40 |
11 | sub counter { |
12 | $count = 10; |
13 | while ($count--) { |
14 | sleep 1; |
15 | print "ping $count\n"; |
16 | } |
17 | } |
18 | |
d9bb3666 |
19 | sub 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 |
28 | print <<'EOT'; |
29 | This test starts up a thread to read and echo whatever is typed on |
30 | the keyboard/stdin, line by line, while the main thread counts down |
31 | to zero. The test stays running until both the main thread has |
32 | finished counting down and the I/O thread has seen end-of-file on |
33 | the terminal/stdin. |
34 | EOT |
35 | |
17f28c40 |
36 | $r = new Thread \&counter; |
37 | |
38 | &reader; |
39 | |
40 | __END__ |
41 | |
42 | |
609f3ea9 |
43 | $count = 10; |
d9bb3666 |
44 | while ($count--) { |
45 | sleep 1; |
46 | print "ping $count\n"; |
47 | } |