I am trying to create an app that allows multiple search requests to occur whilst maintaining use of the user interface to allow interaction. For the multiple search requests, I initially only had one search request running with user interaction still capable by using a backgroundworker to do this. Now I need to extend these functions by allowing more search functions and basically just queueing them up. I am not sure whether to use multiple backgroundworkers or use the threadpool since I want to be able to know the progress of each search job at any time.
If I was using the threadpool all I would do is add this in the loop which gets called each time a search request is made
ThreadPool.QueueUserWorkItem(AddressOf Search)
but if use backgroundworkers this is the only way I know how and I am not how to add these to anything but perhaps an arraylist and I can call reportprogress from each bgw.
edit:
so for example this is my current code
For Each Thread In ThreadList
'Thread.Sleep(500)
SyncLock Me
If searchChoice = "google" Or fromUrl.Contains("google") Then
links = parsingUtilities.GetGoogleLinksFromHtml(fromUrl, html, searchItem)
posts = parsingUtilities.GetPostLinksFromHtml(links)
If links.Count = 0 Then
Exit Sub
End If
Exit For
.....
so in the above code links and posts are arraylists I use to get the urls i need and they are used for different searchchoices and I initially had the synclock on the links and posts but someone else told me to use the synclock me instead. So from your point I should I assign a separate data control for each search control and after sufficient time lock the appropriate one and transfer it to write it. thanks