What exactly does Control.Invoke(Delegate) do to get the delegate to run on the GUI thread? Furthermore, Its my understanding that invoke will block until the invoked function its done. How does it achieve this?
I would like some good gritty details. I’m hoping to learn something interesting.
Edit: The control implements
ISynchronizeInvokeinterface, You can make the same effect using theSynchronizationContextand callPostwhen you callInvoke. something like:Further investigation using Reflector shows that the
Invokeuses some native API calls to achieve that: