Re: [Mono-list] Specific thread for event?
On 12.01.2015 08:53, Michael McGlothlin wrote: 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? In iOS (and many other UI frameworks), the main thread runs a message/event loop which provides callback/synchronization functionality. Something like that (schematic): while (HasMessage ()) { var msg = DequeueMessage () if (msg is Callback) msg.InvokeCallback (msg.Arguments) ... } Usually, these UI frameworks also provide an "InvokeOnUIThread" method which injects a special message into the event queue. You'd have to implement (or reuse) a similar event loop approach for your own threads. Robert ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Specific thread for event?
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 ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list