Yup. Basically that's it. :)

But don't get too ambitious on Perl's ithreads. They are fun, but not as rich as threads from other languages.

Carter Thompson wrote:

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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to