Coroutines thread of execution

Apr 26, 2011 at 12:16 PM

Hi All,

I noticed that, if a coroutine fires the event in a thread different from the caller, when the yield ends all subsequent "actions" in the chain starts in that thread. Would'nt be better if the CoRoutine executor marshal back to the original thread the next executions ?If not, what is the best practice to use to ensure CoRoutine stays on the UI thread ?

Thanks !


Apr 26, 2011 at 2:42 PM

When you implement your IResult, it's up to you to raise the Completed event. If you want it to happen on the UI thread, switch to that thread to raise the event.