You say that the main thread and the worker thread reference each other,
but you also say that you release the references? Only one of those
statements can be true. Either you have a reference to it or you don't?
However, this doesn't mean that the thread stops running.
Is it a COM object that is creating the thread? If so, why do you want
to stop it? The COM object should be responsible for terminating the thread
gracefully, especially if you have released it.
If your object has a thread, and you have implemented IDispose on it,
then you should stop the thread when the Dispose method is called. If you
don't have an implementation of IDispose on this method, then you should.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"MaSTeR" <so***@nospam.com> wrote in message
news:32*************@individual.net...
Hello,
I have an object that at some point creates a thread to run one of its
method.
I create that object within an application and after a while I set its
reference to null to let the gc reclaim it. now the problem is that I want
this thread to stop after the object is being deleted but this object sits
around because its main thread and the one it creates reference each other
even though me, from my application I have not reference of those objects.
Now calling dispose it's not an option because those object get created
via
a COM and I can't change that to call an Unload method or whatever.
Any ideas ?
Thanks everyone.