• 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: autorelease: how does this work!? (if at all)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autorelease: how does this work!? (if at all)


  • Subject: Re: autorelease: how does this work!? (if at all)
  • From: Bill Bumgarner <email@hidden>
  • Date: Fri, 18 Jun 2010 12:34:14 -0700

On Jun 18, 2010, at 12:09 PM, Tony Romano wrote:

> First, the objects are retained by dispatch_async as others have mentioned.  Second, I'm not sure why you used 2 queues for the tasks in your code, seems overly complex.  Async queues are serialized, which means that you can continue to add to the queue and the jobs will be done in order which they were added. The next job will not start until the previous one in the queue is completed.

To be precise, it is the Blocks runtime that takes care of memory management, triggered by dispatch_async()s copying of the block passed to it.

As for their being two queues, that pattern is actually pretty common.  A best practice is to subdivide your application into subsystems and then have one (or more, depending on concurrency used) queue per subsystem.    The queues both allow the application to do work across many cores simultaneously while also providing a natural lock-less exclusion primitive per subsystem.

The trick is to keep the object graphs being acted upon within the subsystems relatively isolated from each other (with the points of contention being carefully considered).

b.bum

_______________________________________________

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: autorelease: how does this work!? (if at all)
      • From: Tony Romano <email@hidden>
References: 
 >autorelease: how does this work!? (if at all) (From: Jonny Taylor <email@hidden>)
 >Re: autorelease: how does this work!? (if at all) (From: Julien Jalon <email@hidden>)
 >Re: autorelease: how does this work!? (if at all) (From: Tony Romano <email@hidden>)

  • Prev by Date: Way to select a file in NSOpenPanel
  • Next by Date: Re: autorelease: how does this work!? (if at all)
  • Previous by thread: Re: autorelease: how does this work!? (if at all)
  • Next by thread: Re: autorelease: how does this work!? (if at all)
  • Index(es):
    • Date
    • Thread