Re: Sharing variable in threaded mpm not working as expected

2011-08-08 Thread Pawel Herman
Hello Torsten and Fred, So I looked at ithreads.pm (found it in an svn repository online http://svn.apache.org/viewvc/perl/modperl/trunk/t/response/TestPerl/) and from what I saw, my approach was theoretically the same as in the test module except that the threads were created after the shared var

Re: Sharing variable in threaded mpm not working as expected

2011-08-06 Thread Vincent Veyron
Le vendredi 05 août 2011 à 07:29 +0200, Pawel Herman a écrit : > You pointed me to a module in the modperl test suite. I downloaded > modperl from http://perl.apache.org/download/index.html but there is > no t/response/TestPerl/ithreads.pm. I also searched for the string > 'threads::shared' in a

Re: Sharing variable in threaded mpm not working as expected

2011-08-04 Thread Pawel Herman
Hello Torsten, I tried your suggestions push(@fruits,share('apple')); and push(@fruits,share(do {my $x='apple'})); but both did not work because share can only take references, arrays, or hashes as input. I tried similar variations but no luck. The fruits array is still initialized multiple time

Re: Sharing variable in threaded mpm not working as expected

2011-08-02 Thread Torsten Förtsch
On Tuesday, 02 August 2011 20:24:46 Fred Moyer wrote: > I haven't used the worker mpm, but it looks like you might want to > preload your handler in the httpd parent process. Unlikely that that will help. threads::shared works by creating a separate perl interpreter to keep the shared values. Tha

Re: Sharing variable in threaded mpm not working as expected

2011-08-02 Thread Pawel Herman
Hello Fred, I already tried the startup.pl file. That didn't help but I can try again. The text you quoted from the docs is familiar to me. That is why I set PerlInterpMax to 1 in my configuration (I want it to block for testing and understanding purposes and intellectual exercise). I initiall

Re: Sharing variable in threaded mpm not working as expected

2011-08-02 Thread Fred Moyer
I haven't used the worker mpm, but it looks like you might want to preload your handler in the httpd parent process. You can do with a startup.pl file. It looks like each thread is initializing a copy of @fruits, which is probably happening at thread creation. However, your current setup will bl