Re: NSConnection in modal windows
Re: NSConnection in modal windows
- Subject: Re: NSConnection in modal windows
- From: James Bucanek <email@hidden>
- Date: Tue, 12 Dec 2006 08:42:26 -0700
Tony Tung wrote on Monday, December 11, 2006:
>I'm trying to create a plugin for aperture. In my plugin, I spawn a
>thread, and use a pair of NSConnections? to communicate between the
>threads. The thread spawning goes fine. But when the worker thread
>tries to retrieve the parent object through [serverConnection
>rootProxy], the code hangs.
>
>This code works fine stand-alone (i.e., not inside aperture). I
>figure it has something to do with the plugin window being modal.
My guess -- and I'm really guessing here because I know nothing about Aperture plug-in environments -- is the thread your plug-in is running in either doesn't have a run loop or it's running in a mode that is blocking distributed object messages.
Either way, I'm not sure you can do much about it. I certainly wouldn't start poking sticks at Aperture's run loop objects, you could end up breaking the whole application.
You might try spawning a second thread and starting your own run loop. I've done this for a number of command-line utilities that use DO for communications. The ugly bit is getting the run loop to terminate. Search the forum archives for the details.
Personally, I wouldn't use DO just to communicate between threads. Pass the object you want to use and gate its access with NSLocks. This will be far more predictable and efficient than trying to use DO (and probably a lot less work than trying to create your own run loop).
--
James Bucanek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden