delegate context
-
An instance of MyClass is running in Thread A. This instance of MyClass instantiates an instance of YourClass. As part of the constructor of YourClass a worker thread (Thread B) is started. When this worker is completed it calls a delegate callback function in MyClass. In which thread context is the delegate function executed? Thread A or B?
-
An instance of MyClass is running in Thread A. This instance of MyClass instantiates an instance of YourClass. As part of the constructor of YourClass a worker thread (Thread B) is started. When this worker is completed it calls a delegate callback function in MyClass. In which thread context is the delegate function executed? Thread A or B?
I think that any function called from a delegate will normally be executed on a thread from the thread pool. Thus it will not be executed on Thread A or Thread B. I have some memory of a way of getting a delegate to execute on a particular thread, but can't recall the details right now.