This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add socklen_t probe; Configure maintenance.
[perl5.git] / ext / Thread / specific.t
CommitLineData
458fb581
MB
1use Thread;
2
3use Thread::Specific qw(foo);
4
5sub count {
6 my $tid = Thread->self->tid;
7 my Thread::Specific $tsd = Thread::Specific::data;
8 for (my $i = 0; $i < 5; $i++) {
9 $tsd->{foo} = $i;
10 print "thread $tid count: $tsd->{foo}\n";
11 select(undef, undef, undef, rand(2));
12 }
13};
14
15for(my $t = 0; $t < 5; $t++) {
16 new Thread \&count;
17}