Spike UK
asked on
Vb.net threads keep increasing
I have written a application (v.net 2015 running on Windows 10) that monitors an external modem for incoming messages.
This works fine.
However, when I look at the Windows 10 Resource manager, there appear to be around 140 threads running because of the application (this is when debugging through Visual studio)
I have commented out sections of the code which I thought may be causing the issue, but the threads still seem high.
Essentially what I am doing is:
sending a message to a modem though a serial port.
capturing the _DataReceived event on the serial port on writing the data to a database.
Using Invokes on this thread to indicate a message has been received by changing the colour of a picture box.
A timer is running in the background the gets the data from the database and writes it to a grid on the form.
A timer is running in the background to place a point on a map (this is temporarily disabled whilst investigating the threading issue)
I have tried adding Thread.CurrentThread.Abort () to the end of the _DataReceived event procedure to force the thread to end but thhe number is still very high.
The threads seem to keep increasing however, if I leave it ideal - they eventually die. Is there a way of disposing of used threads quicker or as they are finished with in vb?
This works fine.
However, when I look at the Windows 10 Resource manager, there appear to be around 140 threads running because of the application (this is when debugging through Visual studio)
I have commented out sections of the code which I thought may be causing the issue, but the threads still seem high.
Essentially what I am doing is:
sending a message to a modem though a serial port.
capturing the _DataReceived event on the serial port on writing the data to a database.
Using Invokes on this thread to indicate a message has been received by changing the colour of a picture box.
A timer is running in the background the gets the data from the database and writes it to a grid on the form.
A timer is running in the background to place a point on a map (this is temporarily disabled whilst investigating the threading issue)
I have tried adding Thread.CurrentThread.Abort
The threads seem to keep increasing however, if I leave it ideal - they eventually die. Is there a way of disposing of used threads quicker or as they are finished with in vb?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER