1use strict;
2use warnings;
3use Test::More;
4use Config;
5
6BEGIN {
7    plan skip_all => 'Perl compiled without ithreads'
8        unless $Config{useithreads};
9    plan tests => 2;
10}
11
12use threads;
13use Digest::MD5;
14
15my $module = 'Digest::MD5';
16
17my $obj = $module->new;
18$obj->add("foo");
19my $tdigest = threads->create(sub { $obj->add("bar"); $obj->hexdigest })->join;
20
21isnt $obj->clone->hexdigest, $tdigest, "unshared object unaffected by the thread";
22
23$obj->add("bar");
24is $obj->clone->hexdigest, $tdigest;
25