On Tue, Oct 28, 2008 at 12:34 PM, Mike Swingler <swingler@apple.com> wrote:
On Oct 27, 2008, at 6:43 PM, Michael Franz wrote:

Mike,

If the runloop is running on Thread 0, can a thread that is not thread 0 pull events off the runloop by using NSApplication.sharedApplication(). nextEventMatchingMask() ?  Where events are the keyboard and mouse events.

Sorry, nope. I'm pretty sure this method has been tried by the SWT folks.

Just so I am clear, there is no easy way for a thread to get the mouse and keyboard events from Thread 0?

A non-easy way might be to implement a producer/consumer pattern.  Where thread 0 is the producer and some other thread is the consumer.
 

How does one 'park' thread 0?

pthread_mutex_lock()/pthread_cond_wait()/pthread_cond_signal(). When we load the AWT, we simply signal Thread 0, to continue and start pumping the event loop. If the AWT never comes up, the thread stays parked indefinitely. This is actually just a modification to how the JVM starts when you request a custom thread stack size for the main thread.

OK, my PThreads book helped clarify this.

Thanks for all your input.

Michael