Multithreading with vb safe?
I run some code. it downloads a file then scans the text for certain keywords. It works fine with no threads.
I add threads to make it faster, so in each new thread a new download is started and the file is scanned using regex.
So if I set max num of threads to 5 at any one time there could be 5 downloads simultaneously.
What I found is that with 5 max threads after a while the pc starts makes bleeping noises from the box (not speakers)
Why is this. Normallly it is due to the GPU overheating. But the vb program harldy uses any graphics. So is it due to too many downloads or something im doing wrong? I did notice the grpx card temps go upto 60 degress but this cant be due to the program could it? If I run it on one or two thread it never has this problem
All downloads are run using httpwebrequest and all scans using regular expressions. All threads are run in the background and this is the code:
Code:
Code:
Dim wc As New txtscan()
wc.threadurl = url
AddHandler wc.Scan_Finished, AddressOf Scan_FinishedEventHandler
AddHandler wc.Scan_Update, AddressOf Scan_UpdateEventHandler
Dim newthread As New System.Threading.Thread(AddressOf wc.getwords)
newthread.IsBackground = True
newthread.Priority = My.Settings.threadpriority
activethreads += 1
newthread.Start()
Any help is appreciated.
Re: Multithreading with vb safe?
Do some logging to the output window or something like that - see what's really going on for thread creation and completion.
I do that.
I actually code my backend services with UI's at first so I can pop into the UI thread and fill nice listboxes and such with run stats.