1898184e3Ssthenuse strict; 2898184e3Ssthenuse warnings; 3*eac174f2Safresh1 4898184e3Ssthenuse Test::More; 5898184e3Ssthenuse Config; 6898184e3Ssthen 7898184e3SsthenBEGIN { 8898184e3Ssthen plan skip_all => 'Perl compiled without ithreads' 9898184e3Ssthen unless $Config{useithreads}; 10b8851fccSafresh1 plan skip_all => 'no threads.pm' 11b8851fccSafresh1 unless eval { require threads }; 12898184e3Ssthen plan tests => 2; 13898184e3Ssthen} 14898184e3Ssthen 15898184e3Ssthenuse threads; 16898184e3Ssthenuse Digest::MD5; 17898184e3Ssthen 18898184e3Ssthenmy $module = 'Digest::MD5'; 19898184e3Ssthen 20898184e3Ssthenmy $obj = $module->new; 21898184e3Ssthen$obj->add("foo"); 22898184e3Ssthenmy $tdigest = threads->create(sub { $obj->add("bar"); $obj->hexdigest })->join; 23898184e3Ssthen 24898184e3Ssthenisnt $obj->clone->hexdigest, $tdigest, "unshared object unaffected by the thread"; 25898184e3Ssthen 26898184e3Ssthen$obj->add("bar"); 27898184e3Ssthenis $obj->clone->hexdigest, $tdigest; 28