in reply to Re^2: sharing array of arrays between threads
in thread sharing array of arrays between threads

++ Thanks for pointing that out. I've updated my node.

-- Ken

  • Comment on Re^3: sharing array of arrays between threads

Replies are listed 'Best First'.
Re^4: sharing array of arrays between threads
by bebe (Novice) on Aug 10, 2012 at 23:51 UTC

    Hi everyone thank you so much for your help....
    Thanks for the tutorials... I'm trying to correct my code ...
    I've successfully tried sharing array X (when X is a one_dim array)... but I'm still having the hardest time converting this code so that array X is looks like below


    X[0] = ("QWE", "RTYU" ,"IOP")
    X[1] = ("QSWE", "TYU" ,"IKOP", "BVC")
    X[2] = ("QE", "TYU")
    X[3] = ("QSWE", "TYU" ,"IKOP", "BVC", "LMNB")
    .
    .
    .

    here is the code that works for one_dim array X

    my @X : shared = ();


    sub abc {
    my $Var2;
    .... Here the string in $Var2 gets updated everytime abc is called ....
    push(@X, $Var2);
    }


    here is how I'm changing this

    my @X : shared = ();

    sub abc {
    my $Var2;
    .... Here the string in $Var2 gets updated everytime abc is called
    push(@{X[$i]}, $Var2);
    }

    I'm still confused, I'm not quite sure how to share the arrays inside of X correctly.
    Could you please help me with that?I greatly appreciate all your help.

    thank you so much