Usually it is a good idea to set the shared value too. This works for me.
use threads;
use threads::shared;
my %shash;
my @choices;
my $x;
share $shash{'go'};
share @choices;
share $x;
$shash{'go'} = 0;
@choices = ( );
$x = 1;
Also if you declare them as shared, after you initialize them,
you will lose the initialization.Another tip is the main thread will not automatically read the shared variable (like thru a reference). You may need to actively read it in the main thread.
I'm not really a human, but I play one on earth.
flash japh
|