S
Sid Price
Hi everyone,
I have a class that creates a thread for some I/O that blocks in the absence
of any activity. I need to be able to shut down that thread when the
application using the class closes. I tried putting my code to close the
thread in the Finalize call of the object but when the app closes Finalize
is not called. A simple solution is to create a public "Close" method for
the object however I would have hoped for an automatic method since the
class in question is to be a reusable class library and it seems better
practice for it to clean up when the instances are destroyed without code
needing to be called by the application using the library.
Any suggestions please?
Sid.
I have a class that creates a thread for some I/O that blocks in the absence
of any activity. I need to be able to shut down that thread when the
application using the class closes. I tried putting my code to close the
thread in the Finalize call of the object but when the app closes Finalize
is not called. A simple solution is to create a public "Close" method for
the object however I would have hoped for an automatic method since the
class in question is to be a reusable class library and it seems better
practice for it to clean up when the instances are destroyed without code
needing to be called by the application using the library.
Any suggestions please?
Sid.