This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
instead of unions use double cast for data pointer <-> function pointer
[perl5.git] / ext / Thread / create.tx
CommitLineData
0fcb073c
JH
1BEGIN {
2 eval { require Config; import Config };
3 if ($@) {
4 print "1..0 # Skip: no Config\n";
5 exit(0);
6 }
0fcb073c
JH
7}
8
0a3e5ca2
GS
9use Thread 'async';
10use Config;
11use Tie::Hash;
12
d9bb3666
MB
13sub 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
0a3e5ca2
GS
22async {
23 tie my(%h), 'Tie::StdHash';
24 %h = %Config;
25 print "running on $h{archname}\n";
26};
27
d9bb3666
MB
28print "Starting new thread now\n";
29$t = new Thread \&start_here, qw(foo bar baz);
30print "Started thread $t\n";
31for ($count = 1; $count <= 5; $count++) {
32 print "main: $count\n";
33 sleep 1;
34}