• 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: Kyle Sluder <email@hidden>
  • Date: Mon, 25 Feb 2013 15:03:13 -0800

On Mon, Feb 25, 2013, at 02:45 PM, Steve Sisak wrote:
>
> 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.

They're orthogonal, but they don't compose well.

1. You cannot assume anything about the thread on which a block runs
after being submitted to a GCD queue (other than the main queue). So no
runloop-dependent technologies for you. That means you cannot call
asynchronous Cocoa APIs from an async queue.

2. Blocking queues is _extremely_ dangerous, to the point where you
mustn't do it. At best, you'll cause GCD to spin up extra worker threads
unnecessarily. At worst, you'll cause deadlock as you exhaust your
thread pool. This means you cannot call synchronous (blocking) Cocoa
APIs from an async queue.

Long story short: do not mix GCD queues and long-term communications
APIs.

--Kyle Sluder
_______________________________________________

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: 
 >[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>)
 >Re: [OT] Sync vs ASync Server Comms (From: Steve Sisak <email@hidden>)

  • Prev by Date: Re: [OT] Sync vs ASync Server Comms
  • Next by Date: Programmatic autolayout problem
  • Previous by thread: Re: [OT] Sync vs ASync Server Comms
  • Next by thread: Re: [OT] Sync vs ASync Server Comms
  • Index(es):
    • Date
    • Thread