| 1 |
root |
1.1 |
BEGIN { |
| 2 |
|
|
eval { require Config; import Config }; |
| 3 |
|
|
if ($@) { |
| 4 |
|
|
print "1..0 # Skip: no Config\n"; |
| 5 |
|
|
exit(0); |
| 6 |
|
|
} |
| 7 |
|
|
} |
| 8 |
|
|
|
| 9 |
|
|
use Thread 'async'; |
| 10 |
|
|
use Config; |
| 11 |
|
|
use Tie::Hash; |
| 12 |
|
|
|
| 13 |
|
|
sub start_here { |
| 14 |
|
|
my $i; |
| 15 |
|
|
print "In start_here with args: @_\n"; |
| 16 |
|
|
for ($i = 1; $i <= 5; $i++) { |
| 17 |
|
|
print "start_here: $i\n"; |
| 18 |
|
|
sleep 1; |
| 19 |
|
|
} |
| 20 |
|
|
} |
| 21 |
|
|
|
| 22 |
|
|
async { |
| 23 |
|
|
tie my(%h), 'Tie::StdHash'; |
| 24 |
|
|
%h = %Config; |
| 25 |
|
|
print "running on $h{archname}\n"; |
| 26 |
|
|
}; |
| 27 |
|
|
|
| 28 |
|
|
print "Starting new thread now\n"; |
| 29 |
|
|
$t = new Thread \&start_here, qw(foo bar baz); |
| 30 |
|
|
print "Started thread $t\n"; |
| 31 |
|
|
for ($count = 1; $count <= 5; $count++) { |
| 32 |
|
|
print "main: $count\n"; |
| 33 |
|
|
sleep 1; |
| 34 |
|
|
} |