• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Service with NSURLConnection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Service with NSURLConnection


  • Subject: Re: Service with NSURLConnection
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 11 Jan 2013 11:45:12 -0800

On Jan 11, 2013, at 11:09 AM, Jim Thomason <email@hidden> wrote:

> For sake of argument, assume that the work has to be done in an external thread, or I have to jump in and out of the main thread some how. I'm not actually using URL connections like this in the actual app, I was just hoping that it was a nice simple example use case to give. For the actual code, I wouldn't be able to just do a synchronous request.

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.

—Jens
_______________________________________________

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


  • Follow-Ups:
    • Re: Service with NSURLConnection
      • From: Uli Kusterer <email@hidden>
References: 
 >Service with NSURLConnection (From: Jim Thomason <email@hidden>)
 >Re: Service with NSURLConnection (From: Jens Alfke <email@hidden>)
 >Re: Service with NSURLConnection (From: Jim Thomason <email@hidden>)

  • Prev by Date: Re: Service with NSURLConnection
  • Next by Date: Re: How to force creation of default persistentStore/autosave in NSPersistentDocument
  • Previous by thread: Re: Service with NSURLConnection
  • Next by thread: Re: Service with NSURLConnection
  • Index(es):
    • Date
    • Thread