Hi all ,
I am using threads in my code , and somewhere in Perl documentation I saw that I shall use queues for threading - if I dont want any memory leaks.
Today , I have big scripts that can simoultaniously run 24 threads , which I can see - after the threads end, the memory doesnt clean itself.
I read about queues to threads in Perl , but I didnt got the idea, so I need a little help there.
Is the idea is creating some pool of lets say 10 threads , and every time there is a job - the job is sent to an available thread ?
my need is to each thread to return something when it ends - which I put inside a hash , and then use this hash.
Can some one help me with that and explain me the theory ?
this is my current code
#Start new thread
my $t1 = threads->new (\&$functions_name1,@parameters1);
my $t2 = threads->new (\&$functions_name2,@parameters2);
my %hash_results = ();
foreach my $thread (@threads) #wait for all threads untill the end
+and insert results to hash