<sk...@pobox.comwrote:There's an object providing a representation of the thread, but theThe garbage collector deals with objects, not processes. The process
will exit when there are no non-background threads left running. My
guess is that your new thread isn't a background thread.
I thought since thread is an object it would be collected too.
thread itself isn't an object. It's like a file - just because a
FileInfo may be garbage collected doesn't mean the file is deleted.
Anyway, thread was a foreground one. That was the problem.Right.
Now I've set it to be a background and it works fine.
If I want to shut down the process, I'd make sure that the thread is aIf I execute Thread.Abort() and Thread.Join() and then close the form
- everything is OK. No orphan processes are left hanging.That sounds pretty odd. As Marc said, Thread.Abort should be avoided
anyway. See
How would you break from a thread that is block by a blocked call ?
background thread. Otherwise, I'd either avoid blocking calls, or just
let the thread wait.
That is the situation I have.Making things block gives the penalty of not always being able to shut
I could use async calls but didn't want to.
things down quickly, basically.
If it's part of that class then it does have an active reference - theDoes your other thread have an active reference to the form?
No it doesn't but it's a part of that class and since it won't
terminate (foreground thread) I suppose GC doesn't try to collect that
class.
implicit "this" reference.
Jon