diff options
| author | Mark Murray <markm@FreeBSD.org> | 1998-09-09 07:00:04 +0000 | 
|---|---|---|
| committer | Mark Murray <markm@FreeBSD.org> | 1998-09-09 07:00:04 +0000 | 
| commit | ff6b7ba98e8d4aab04cbe2bfdffdfc9171c1812b (patch) | |
| tree | 58b20e81687d6d5931f120b50802ed21225bf440 /contrib/perl5/ext/Thread/specific.t | |
Diffstat (limited to 'contrib/perl5/ext/Thread/specific.t')
| -rw-r--r-- | contrib/perl5/ext/Thread/specific.t | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/contrib/perl5/ext/Thread/specific.t b/contrib/perl5/ext/Thread/specific.t new file mode 100644 index 0000000000000..da130b1d64c72 --- /dev/null +++ b/contrib/perl5/ext/Thread/specific.t @@ -0,0 +1,17 @@ +use Thread; + +use Thread::Specific qw(foo); + +sub count { +    my $tid = Thread->self->tid; +    my Thread::Specific $tsd = Thread::Specific::data; +    for (my $i = 0; $i < 5; $i++) { +	$tsd->{foo} = $i; +	print "thread $tid count: $tsd->{foo}\n"; +	select(undef, undef, undef, rand(2)); +    } +}; + +for(my $t = 0; $t < 5; $t++) { +    new Thread \&count; +} | 
