Is this really as easy as it seems or am I over looking something?

I have an array with references to tests.  I want to loop through each
element in the array, call a subroutine passing in the test reference
using a thread.   When all tests (threads) have been started I want to
loop through all threads and join so I can retrieve relevant data.

# Start threads.
my @threads = ();
foreach my $ref (@individual_tests) {
    $thr = threads->new(\&run_test, $ref);
    push(@threads, $thr);
}

# Retrieve data
foreach my $thr (@threads) {
    my $results = $thr->join();
 }

# run_test sub
sub run_test {
        my $ref         = shift;

        # do stuff in here.

}



Thanks for looking this over.

Carter.

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to