Re: Life of a thread
From: J. Buelna - Houston, TX (jbuelna-not_at_microsoft...yet.com)
Date: 03/22/05
- Next message: frenchyyy: "Extensibility project in c# .NET for Word2003"
- Previous message: John Timney \(ASP.NET MVP\): "Re: A Map of my Solution ! - any tool available !"
- In reply to: Zeng: "Life of a thread"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Mar 2005 17:38:05 -0600
"Zeng" <Zeng5000@hotmail.com> wrote in message
news:efdWI4xLFHA.3812@TK2MSFTNGP10.phx.gbl...
> Hi,
> If a thread goes out of scope and the working proc (ThreadStart) is done
> processing, does it eventually get finalized just like unreferenced
> memory?
>
> thanks!
>
Yes. Unless, of course, you have unmanaged resources (like a database
connection) in the thread. Then you may eventually wind up with a
noticeable leak. You can use a class to govern the thread. Make sure it
inherits : IDisposable and add a ~Destructor to handle all unmanaged
resources.
You may also want to run the worker thread with the IsBackground property
set to true so destruction happens immediately if the main app is
terminated.
J. Buelna - Houston, TX
- Next message: frenchyyy: "Extensibility project in c# .NET for Word2003"
- Previous message: John Timney \(ASP.NET MVP\): "Re: A Map of my Solution ! - any tool available !"
- In reply to: Zeng: "Life of a thread"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|