[email protected] <> wrote:
> Hi,
>
> I am using threads and perl and after a particular number of thread
> creation/destruction (2 to 15) perl crashes when doing a join.
>
> I saw a similar problem dated from July 2004:
> http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-users/2131329
>
> Any idea if I am facing the same problem on Perl 5.10 ?
> Any idea if there is any workaround ?
Perhaps you could provide more detail. A small example script that
demonstrates the problem would be good.
For example, the following script, which creates a lot more than 15
threads, has run to completion on my box every time so far (Activestate
Perl 5.10.0 build 1004, on XP):
use strict;
use warnings;
use threads;
my $at_a_time = 20;
for (1..10) {
print "------------------\n";
print "Iteration $_\n";
for (1..$at_a_time) {
my $thr = threads->create(\&threadsub);
}
print "Waiting for threads to finish\n";
while (threads->list(threads::all) > 0) {
foreach my $thr (threads->list(threads::joinable)) {
my $result = $thr->join();
my $id = $thr->tid();
print "Result for thread $id is $result\n";
}
select undef, undef, undef, 0.1;
}
print "All threads finished\n";
}
sub threadsub {
my $id = threads->tid();
print "Thread $id starting\n";
my $delay = int(rand(5)) + 1;
sleep $delay;
print "Thread $id terminating\n";
return $delay;
}
HTH
--
Brian Raven
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient or have received this e-mail in error, please advise
the sender immediately by reply e-mail and delete this message and any
attachments without retaining a copy.
Any unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs