On Mar 19, 2010, at 2:31 PM, Philippe Sismondi wrote:

Right - that's exactly my question - I don't know that I have to do this while loop. Is starting the thread after the window pops up enough? Is there anything about *not* waiting for NSApplication to set this window as its modal window that might cause a problem with getting input from the window?

You shouldn't be trying to interact with the window at all from a background thread. Most of AppKit isn't thread-safe, and it's also not a clean separation of responsibilities. Thread-safe programming is really, really hard, and the best way to make it simpler is to limit the data shared between threads to the absolute minimum.

The best model (IMHO) for background threads is message-passing. You start the thread with some input data, it runs and returns some output data that the main thread receives. If you need to give more data to the thread while it's running, make the thread run a runloop and use one of the threaded -performSelector calls to send it messages. (It can likewise send data back to the main thread the same way.)

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to