Another thread question
Posted on 2011-03-02
Lets say I have a class like this
public class MyThreadWorkerClass
public sub DoWork()
' do work
In this class I start the threads
public class ThreadStarter
public sub StartMyThreads()
if threadcnt < maxThreadCnt then
dim tWorker as new MyThreadWorkerClass
dim t as new Thread(AddressOf MyThreadWorkerClass.DoWork)
threadcnt += 1
My question is this. When the thread aborts itself, does that kill the thread and tworker object (set them to nothing) or does this leave objects hanging, eventually leading to a memory leak?
How would you set the objects to nothing otherwise when the thread finishes?