Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / perl5 / ext / Thread / create.t
1 use Thread 'async';
2 use Config;
3 use Tie::Hash;
4
5 sub start_here {
6     my $i;
7     print "In start_here with args: @_\n";
8     for ($i = 1; $i <= 5; $i++) {
9         print "start_here: $i\n";
10         sleep 1;
11     }
12 }
13
14 async {
15     tie my(%h), 'Tie::StdHash';
16     %h = %Config;
17     print "running on $h{archname}\n";
18 };
19
20 print "Starting new thread now\n";
21 $t = new Thread \&start_here, qw(foo bar baz);
22 print "Started thread $t\n";
23 for ($count = 1; $count <= 5; $count++) {
24     print "main: $count\n";
25     sleep 1;
26 }