Re: Service with NSURLConnection
Re: Service with NSURLConnection
- Subject: Re: Service with NSURLConnection
- From: Uli Kusterer <email@hidden>
- Date: Sat, 12 Jan 2013 05:31:12 +0100
On 11.01.2013, at 20:45, Jens Alfke <email@hidden> wrote:
> Then you’ll need to block the main thread until the background thread finishes its work. You could use an NSConditionLock to do that — main thread creates the lock and locks it, passes the lock to the background thread, then blocks waiting for the condition to change. The background thread sets the condition when it finishes its work.
If for some reason this doesn't work, you could also try running an NSRunLoop in the main thread that checks for your second thread being finished. Haven't tried that, but it would keep the main thread from returning until you actually have data.
Of course, in any way, both approaches would probably cause the app from which your service was invoked to beachball until you return.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://groups.yahoo.com/group/mac-gui-dev/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden