develooper Front page | perl.ithreads | Postings from March 2010

Re: Installing Perl ithreads in perl 5.8

Thread Previous | Thread Next
Brian J. Miller
March 23, 2010 05:39
Re: Installing Perl ithreads in perl 5.8
Message ID:
Elizabeth Mattijsen wrote:
> On Mar 23, 2010, at 6:00 AM, Ajeet Kumar wrote:
>> I want to share variable among threads, where threads are created using  fork, not using ithreads.So, How to move with it? I had tried the following :-
>> 1.) Declared a variable in main process
>> 2.) taken it's reference in main process
>> 3.) Now, as because the reference is available two all of my threads, I tried to change the value of my variable using the reference.
>> 4.) However, changes done by the thread is only reflected to that particular thread only, not to other thread and even not in the main process.
>> Please, give any solution, without using any ithreads or any other thread model.(I don't want to rebuild the perl interpreter)

You might want to look into POE::Wheel::Run combined with an example check out this from the cookbook:

POE should help with the mgmt of the forks and the IPC between them. If 
that example seems to provide some assistance then definitely do more 
research on POE, the learning curve is pretty steep but I found it well 
worth it in the end.

> Use forks.  Have you *looked* at forks?  Do you read what people tell you?  Do you read the documentation?
> Otherwise, if forks doesn't do it for you: don't use Perl, use C.
> Liz

Brian J. Miller
End Point Corp.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About