How does the BackgroundWorker class fire its events on the UI thread?
I'm in the process of writing a asynchronous-operation manager somewhat similar to the BackgroundWorker
class. I know that the BackgroundWorker
does some internal vo开发者_JAVA技巧odoo (using the AsyncOperation
class, from what I've read) to fire its events on the thread that created the BackgroundWorker
, which is typically a UI thread.
My question is: what voodoo is necessary for events to get fired on a specific thread like the BackgroundWorker
does?
It is using SynchronizationContext Class
精彩评论