I
ice88
I would like to execute some code when a thread terminates, in the
context of that thread - I guess similar to an ExitThread handler - is
it possible in a C# .NET application?
I can see a way to execute code when a thread is thrown away - by
having per-thread static attributes that are themselves objects, when
the thread object associated with that static value is garbage
collected, the destructor for the object is driven - but that happens
on another thread, I need the execution to happen on the thread that
is ending (because I'm going to make a call to unmanaged code to clear
up some things which the unmanaged code has associated with the
thread)...
I would like to believe that the framework does provide for a 'thread
is about to be deleted' class, which implements some interface - but I
cannot find it - unless IDisposable does it?
context of that thread - I guess similar to an ExitThread handler - is
it possible in a C# .NET application?
I can see a way to execute code when a thread is thrown away - by
having per-thread static attributes that are themselves objects, when
the thread object associated with that static value is garbage
collected, the destructor for the object is driven - but that happens
on another thread, I need the execution to happen on the thread that
is ending (because I'm going to make a call to unmanaged code to clear
up some things which the unmanaged code has associated with the
thread)...
I would like to believe that the framework does provide for a 'thread
is about to be deleted' class, which implements some interface - but I
cannot find it - unless IDisposable does it?