• 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: How to implement "while there are objects in the array - run runloop" idea?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to implement "while there are objects in the array - run runloop" idea?


  • Subject: Re: How to implement "while there are objects in the array - run runloop" idea?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 26 May 2011 11:39:35 -0700

On May 26, 2011, at 10:56 AM, Nick wrote:

> I have a custom (not main) thread, that adds objects to an NSArray at random times.
> ...
> Is there any way to make the RunLoop (after it has processed all
> NSUrlConnection's asynchronous things)  check, if there are some objects in
> my NSArray queue, and if there are - to initiate new NSURLConnections, if
> there are not, and if there are no other events pending, just 'block', as
> the runloop always does?

The background thread needs to do something to wake up the main runloop after it adds an object to the array. Calling -performSelectorOnMainThread: would be an ideal way to do this. If you do that, you may not even need to use an array to queue the objects; instead just pass each object to the main thread as the parameter to that perform.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >How to implement "while there are objects in the array - run runloop" idea? (From: Nick <email@hidden>)

  • Prev by Date: Re: How to implement "while there are objects in the array - run runloop" idea?
  • Next by Date: Re: How to implement "while there are objects in the array - run runloop" idea?
  • Previous by thread: Re: How to implement "while there are objects in the array - run runloop" idea?
  • Next by thread: Drawing an arc fill inside an image
  • Index(es):
    • Date
    • Thread