Clear questions and runnable code
get the best and fastest answer
Re: creating unknown number of threads and then join resultsby BrowserUk (Pope)
|on Jul 29, 2013 at 23:42 UTC||Need Help??|
maybe locking the variable before I update it? I was thinking that each thread is updating a different hash key of the variable, so it should be safe to update this way? Or does it need to be locked before each join statement?
All your updates to %Found are done within the same thread, so there is no need to lock anything. Besides which %Found isn't a shared variable, so you couldn't lock it if you tried.
Any suggestions on how to do this better?
Apart from this:
Could be more efficiently written as:
Not really. It is hard to see any scope for you not getting all the results produced by the external commands.
Perhaps you could print out the size of @results before returning and then sum those and compare it with the size of @Final?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.