in reply to Re: Re: OO and Threads conflict?
in thread OO and Threads conflict?
What about declaring the variable shared before assigning it to your hash, as in my $var : shared = 1; $self->{var} = \$var. Although on further consideration I wonder if it might be better to be using a package variable via our or use vars since it looks like what you want is a 'static' variable i.e., one shared by all instances of a class, and these constructs provide that behavior. I don't have threads compiled so I can't test this, but this might work:
package OOThread; use threads; our static_var : shared = 1; # may not be necessary to explicitly shar +e 'our' variables sub new {...} ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: OO and Threads conflict?
by Anonymous Monk on Sep 20, 2002 at 22:41 UTC |