|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AppDomain and Multi-Threadingfollowing situation (this is still .NET 1.1 - *sigh*) For a scheduling application, I create a Thread for every task that is due to be executed. Once a task execution is due, a running Thread will be created. The runner thread in turn will instantiate a TaskRunner object in a new AppDomain, so it is like that. The TaskRunner then instantiates the Task class and calls a method on an interface: 1. Create New Thread 2. Thread creates new AppDomain 3. TaskRunner is created in new AppDomain 4. TaskRunner instantiates task class and executes interface method 2. - 4. all happen on the same (newly created thread) After the TaskRunner has executed the task method, it cleans up, however when the Thread calls to unload the AppDomain it previously created, the whole thread is aborted and no code is executed anymore after the unload. I don't quite understand why this would happen. My worker thread runs on the main AppDomain and creates/unloads a child AppDomain. I wonder why unloading that child AppDomain would kill my worker thread. Any help would be highly appreciated. Thanks Kai |
|||||||||||||||||||||||