Problem: I am working on a ASP.NET 2.0/C# Application and I need to do the following:
I have a function I am using from a third-party library lets say
MyFunctions.CalculateTotal(int a, int b);
A known issue is that the thread locks resources. So there is another function that needs to be called afterwards to clean everything up.
MyFunctions.ThreadExit();
The issue is that this will exit the current thread and I will not be able to use any other function afterwards. Also, it does not seem appropriate for me to kill an asp.net thread like this.
I have considered spinning a separate thread, but that would be a hack.
Global.asax has those application wide events like Application_Start/End
I know there is no event such as Application_ThreadStart/End, but maybe something like that?
Any other suggestion for a possible solution?