in reply to Shared Thread Pool (used more then once,)

I'm not able to understand your code, but just glancing at the code you have used undef on your shared array @Data numerous times.
#for instance you have # Manage the thread pool until signalled to terminate while (! $TERM) { my $t; undef @Data; ################################# # and undef @Data; # Clear the shared array so that it can be used a +gain for the next for target
Are you sure that undef'ing a shared array is a correct way of clearing out the array? I might think you would use lock on @Data, and then do @Data = ();

That brings up locking shared variables, your symptoms are similar to those where unlocked shared variables get clobbered by other threads accessing @Data.

See Threads: why locking is required when using shared variables

Replies are listed 'Best First'.
Re^2: Shared Thread Pool (used more then once,)
by BrowserUk (Patriarch) on Nov 15, 2013 at 21:51 UTC
    Are you sure that undef'ing a shared array is a correct way of clearing out the array? I might think you would use lock on @Data, and then do @Data = '';

    undef works perfectly on shared arrays.

    Your method is completely broken, as it leaves the array with a single element containing a zero length string.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.