Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creation of Multiple threads

Posted on 2009-04-14
3
Medium Priority
?
328 Views
Last Modified: 2013-12-25
How to create a multiple threads on a function ?

my $thrcount = getValueFromPath($testcase,"TestCase/TCount");

which returns a count from an xml , which is loaded in $testcase.

i want create $thrcount of  threads on a function called putdata.

sub putData {
   ......
   ......
}

How to create Multiple threads on this function which are equal to $thr count ?

Please advise , i am new to Perl and threading
0
Comment
Question by:koti688
3 Comments
 
LVL 10

Accepted Solution

by:
oleber earned 1000 total points
ID: 24135596
Instead of giving you a solution, I suggest you to read

http://perldoc.perl.org/perlthrtut.html

0
 

Author Comment

by:koti688
ID: 24135614
hi oleber ,

i have read the documentation, but i can able to create one  thread on a function.

when i have a variable count , how to create that many number of threads on this function ? please help
0
 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 1000 total points
ID: 24139612

my @all_threads;
for(1..$thrcount) {
    push @all_threads, threads->create(\&putData);
}

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question