Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MultiThreading - no idea how to begin!!

Status
Not open for further replies.

NashTrump

Technical User
Jul 23, 2005
38
GB
Hi All,

Im new to multithreading!!

I have created two files which access a database, each extracts a large amount of lines relating to a certain word and then processes each line.

As its a huge task im looking into multithreading.

However i have heard i must be careful to make sure that my variables arent used or changed by another thread.
I was thinking about using a variable which i can name acording to the thread id.

IE: Name$id

Or something...
Does anyone know how this would work or does anyone have a good idea on how to multithread?

Im lost on this!!

Kind regards

Nash (v. confused!!)
 
Search on cpan for the module named Thread. It'll do what you're looking for.

As for naming variables dynamically; ishnid, if you would?

- George
 
As for naming variables dynamically; ishnid, if you would?

What does that mean??
 
ishnid is another person on this forum that answers the dynamic variable question perfectly.

- George
 
Ishnid.... please can you help me out here!!!
 
Here's the oft-referenced article: Why it's stupid to use a variable as a variable name.

In summary - using "soft references" (as variable variable names are known) cause potential security holes and maintainability issues. Having unexpected data in variables that are used to reference other variables can cause your code to break in places you thought were totally unrelated. There's almost never a reason not to use a hash instead.

Oh, and thanks for the recommendation George :-D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top