Imagine a cross-platform library that has to create its own windows without relying on WinForms/GTK#/WPF/MonoMac/etc (this is OpenTK in case anyone is interested).
Here is the deal: Windows and X11-capable Unices support (or can work with) multiple event loops, one on each thread. This means (a) you can create one window per thread and have them work independently and (b) you can run a WinForms (or GTK#, WPF, ...) window on one thread and open an OpenTK window on a different, without interference.
Now, to the best of my - admittedly limited - knowledge, Carbon does not support this. OS events are only delivered to the "main" event loop and all secondary threads run on fumes (that is, ReceiveNextEvent always returns eventLoopTimedOutErr and doesn't find any events). OpenTK itself can work with this limitation, no problem, but this poses an interesting problem to applications that try to mix OpenTK with a different toolkit (e.g. MonoMac) to present a configuration window.
Two options:
Here is were you come in: can you think of any way to make this work? Imagine the following scenario:
Is it possible to filter events from thread #1 and deliver them to thread #2 as necessary? Could CF somehow help here? Gurus of Mac OS X, please help!
(Programming language doesn't matter, use anything you are familiar with. I'd prefer a Carbon-based solution but Cocoa would work just fine.)
Passing the events from one thread to another should work as far as just plain getting the events delivered. The sticky part is that a lot of the UI-related APIs are not thread safe, even though the core Carbon Event handling is. Anything that involves updating controls and drawing should probably be handled back on the main thread. That would require a lot of back-and-forth, and it may not be worthwhile to try to make it work.