.net - multithreading loop effecient?right? -


I have the following multi threading function to apply to parse the difficulty content in the thread from the list of URLs. The code was suggested by a user and I want to know that this is an effective way of implementing me. I am running the code now and am getting errors on all the tasks which managed to fix the single thread. For example, for a list I now use to visit the URL; I was getting 'ArgumentOutRangeException - the capacity was lower than the current size'? / Now everything needs to be synchronized

  dim startwatch new stopwatch dim elapsedTime long = 0 dim urlCompleteList string as in the form of = String.Empty dim numThread integer = 0 Threadlist new list (thread of) as startwatch.Start () for completeList slow thread = new thread (AddressOf processUrl) thread.Start (link) ThreadList.Add (thread) next to each link) thread list Thread. Join () next to each thread in startwatch.Stop (elapsedTime = startwatch.ElapsedMilliseconds End Sub code here To enter the Public Sub processUrl (ByVal uRL String) enter 'URL' to be sure that we never visit this before visiting pages.Contains (visit URL) then ** visit page (url) ** DIME STARTWatch As if the new stopwatch is slowed down as long as I = 0  

if < Code> VisitPages is shared between the processUrl threads, so yes, you can use that archive at a time only. Thread needs to assure - as long as the collection is thread safe and takes care of that for you

.

The same thing with any other data that is shared between the threads you have created.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -