Steve Hay wrote:
Stas Bekman wrote:


But I don't get the segfault.

I'd like to explore the possibility that we have a need for CLONE in Perl sections and PerlLoadModule next. I wish I had the segfault, though. I need to think how to create it. But if I fail I'll try to analyze whether we CLONE is needed. If you don't know what CLONE is please see:
http://apache.org/~stas/Example-CLONE-0.02.tar.gz



I had a look at Example-CLONE. When I run "nmake test" it passes all tests successfully, but then I get an application error popup, and it spits out "A thread exited while 2 threads were running" on the console. It's OK if I run the two tests, basic.t and threads.t, individually.

Yes, that's a known problem in perl threads. Try replacing detach call with join:



Index: t/threads.t =================================================================== RCS file: /home/stas/cvs/modules/Example-CLONE/t/threads.t,v retrieving revision 1.1 diff -u -r1.1 threads.t --- t/threads.t 31 Dec 2003 05:40:32 -0000 1.1 +++ t/threads.t 12 Jan 2004 17:17:25 -0000 @@ -31,7 +31,7 @@

 # as the new threads are spawned they will inherit the count from the
 # main thread
-threads->new(\&read_test)->detach for 1..$threads;
+threads->new(\&read_test) for 1..$threads;

 sub read_test : locked {
     for my $count (1..2) {
@@ -42,8 +42,5 @@
     }
 }

-# workaround the situations where the main thread exits before the
-# child threads, which shouldn't be a problem since all threads are
-# detached, but something is broken in perl
-select(undef, undef, undef, 0.25); # sleep 0.25sec
+$_->join() for threads->list();



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to