[Mono-list] Specific thread for event?

Robert Jordan robertj at gmx.net
Mon Jan 12 12:15:39 UTC 2015


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



More information about the Mono-list mailing list