assync call returns on wrong thread
-
When you assynchronously invoke a delegate using begin invoke, much to my dismay the AsyncCallback it calls when finished is called on the wrong thread. The AsyncCallback is called on the same thread the assync processessing was done in. This is very annoying :mad::mad: What I need is for the main thread to be notified, so that from the callback method I can then call a method on the main thread. Anyone figured out how you can do this ???
-
When you assynchronously invoke a delegate using begin invoke, much to my dismay the AsyncCallback it calls when finished is called on the wrong thread. The AsyncCallback is called on the same thread the assync processessing was done in. This is very annoying :mad::mad: What I need is for the main thread to be notified, so that from the callback method I can then call a method on the main thread. Anyone figured out how you can do this ???
Go read this article. Even if you aren't working with a UI on the main thread, the techniques still apply.
Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing
-
Go read this article. Even if you aren't working with a UI on the main thread, the techniques still apply.
Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing
Hi David, Thanks for the link, it was very interesting. However I still cant see how the parent thread can be called when you are not working with windows forms, for example if you are working in a console app. I myself am specifically working with a class instantiated from the main form but not the main form itself. I tried inheriting from Control but this didnt work. What I need is the equivalent of Control.BeginInvoke but which can be used outside a form. Is it impossible ?