cbrauner has asked for the wisdom of the Perl Monks concerning the following question:
im using a defined hash both in the main block as in a thread too:
my %h => ( X => { num => 1, txt => 'X' }, Y => { num => 2, txt => 'Y' }, Z => { num => 3, txt => 'Z' }, ); my $thr = threads->new(\&thr_func, \%h); ...LOOP-MAIN #using the hash on in readonly mode (eg print all values from hash) ...END LOOP-MAIN sub thr_func { my ($h_ref) = @_; ...LOOP-THR #using the hash on in readonly mode (eg print all values from hash) ...END LOOP-THR }
is this thread safe if i dont modify values on the hash ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: is a readonly hash thread safe ?
by Anonymous Monk on Jul 15, 2009 at 09:01 UTC | |
by cbrauner (Novice) on Jul 15, 2009 at 09:19 UTC | |
by Corion (Patriarch) on Jul 15, 2009 at 09:24 UTC | |
by gulden (Monk) on Jul 15, 2009 at 11:12 UTC | |
by Anonymous Monk on Jul 15, 2009 at 11:22 UTC | |
by cbrauner (Novice) on Jul 15, 2009 at 12:37 UTC | |
by Corion (Patriarch) on Jul 15, 2009 at 12:48 UTC | |
by Anonymous Monk on Jul 15, 2009 at 09:27 UTC |