in reply to Passing self to process as reference

you are storing a hash reference to the first index on the array.
my @paramters = ($self); my $thread = new Thread \&processJobs, \@paramters;
And in processjobs you are expecting the hash reference
sub processJobs { my $self = shift; }
if my understanding on your post is correct, why can't you change line like this
my $thread = new Thread \&processJobs, $self; and in process jobs use like this sub processJobs { my $self = $_[0]; }
This is not an answer to your question, but I saw an un-necessary use of an intermediate array, i pointed you that.


Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

Replies are listed 'Best First'.
Re^2: Passing self to process as reference
by Anonymous Monk on Mar 18, 2009 at 10:14 UTC
    Thanks for the reply! Passing $self like this is pass by value. I wan't to pass it by reference. At the moment, updating a value in self via the main thread is not being reflected in my process because i only have a copy of self.