[Mono-list] Specific thread for event?

Michael McGlothlin mike.mcglothlin at gmail.com
Mon Jan 12 07:53:38 UTC 2015


I had the general idea of making an event that would invoke every handler in its list on the thread it was registered from. So I added accessors that'd store the thread and set things up so when I invoke the handlers it'd use those threads .. only there seems to be no way to run code on a specific thread in C# (possibly if I did something unsafe with internal threading?) as far as I can see. I messed around with the ExecutionContext and various other things but none seems to let you interrupt a running thread, do something, and resume.

The best I have been able to manage is having the main UI thread get special treatment in iOS. That's actually what I want but I'd like a more universal solution as it's likely I'll have other components that are picky about what thread they're on. Seems like having events raised on the correct thread automatically would be a good behavior and avoid a lot of boilerplate code.

Obviously something has been done with iOS to make it possible to access the main thread. Am I missing something or is this pretty much a deadend?


Sent from my iPad


More information about the Mono-list mailing list