• 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: [OT] Sync vs ASync Server Comms
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] Sync vs ASync Server Comms


  • Subject: Re: [OT] Sync vs ASync Server Comms
  • From: Steve Sisak <email@hidden>
  • Date: Mon, 25 Feb 2013 17:45:14 -0500

At 3:18 PM +0000 2/25/13, Dave wrote:
On 25 Feb 2013, at 13:57, Steve Sisak wrote:
Created A, B, C, make C dependent on A, B, submit all of them to an NSOperationQueue and wait for C to complete (or put your completion code on a block dependent on C -- NSBlockOperation makes this really easy.

This was just a simplistic example, unfortunately in real life it's not possible to use an Operation Queue effectively for what needs to be done, and, anyway, the code is much harder to read and maintain to use one.

Why? I use them for some very high performance stuff.

Also, you don't have to do everything on the main thread -- I frequently use a (single) background server thread which sits in a runloop and do everything but the UI from there.

This keeps both you UI and engine responsive.

Yes, that's basically the same conclusion I came to, but if do this, it negates a lot of the initial simplicity of using that approach, so, at that point it's a toss up on which method is preferable.

The current trend is away from threads and toward asynchronous programming.

That's orthogonal to whether your tasks are run on a single (XXRunLoop) or multiple (GCD) threads -- the advantage of GCD is that the system gets do decide how many worker threads to fire up based on the number of cores available, system load, and who's blocked.

NSOperationQueue adds dependencies -- you can do similar things with blocks and dispatch_groups.

If you don't like NSOperationQueue, go bare metal and use GCD directly.

I suggested NSOperationQueue because it's exactly the right tool for your example.

WAYRTTD?

-Steve
_______________________________________________

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: [OT] Sync vs ASync Server Comms
      • From: Kyle Sluder <email@hidden>
References: 
 >[OT] Sync vs ASync Server Comms (From: Dave <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Uli Kusterer <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Dave <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Uli Kusterer <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Dave <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Fritz Anderson <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Dave <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Jens Alfke <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Dave <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Steve Sisak <email@hidden>)
 >Re: [OT] Sync vs ASync Server Comms (From: Dave <email@hidden>)

  • Prev by Date: Documents not opening from Finder
  • Next by Date: Re: [OT] Sync vs ASync Server Comms
  • Previous by thread: Re: [OT] Sync vs ASync Server Comms
  • Next by thread: Re: [OT] Sync vs ASync Server Comms
  • Index(es):
    • Date
    • Thread