Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: bug in threads::shared or is it just me?

by choroba (Cardinal)
on Apr 05, 2012 at 15:50 UTC ( [id://963705]=note: print w/replies, xml ) Need Help??


in reply to bug in threads::shared or is it just me?

yield is not needed:
use warnings; use strict; use threads; use threads::shared; use Data::Dumper; sub test { my %h : shared; for (1 .. 3) { threads->create(sub { my $n = shift; lock %h; $h{$n} = rand; }, $_)->join; } return %h; } print Dumper {test()};

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://963705]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found