• 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: Asynchronous Notification Does NOT Work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asynchronous Notification Does NOT Work


  • Subject: Re: Asynchronous Notification Does NOT Work
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 05 Jun 2011 13:34:38 -0500

On Jun 5, 2011, at 11:20 AM, Bing Li wrote:

> My system is a Cocoa Application. I know RunLoop is created automatically in
> such a project. So asynchronous notification should work.

A Cocoa application does automatically run the run loop of the main thread, if you allow it.  So, I have a couple of questions:

1) Are you queuing these notifications on the main thread?

2) Are you allowing the flow of execution to return back to the framework, thus allowing it to run the run loop?

Another point: it was recently discussed on this list that the NSPostASAP posting style has a very specific meaning.  Notifications queued with that style are delivered immediately after a run loop source or timer has been serviced.  If no run loop sources or timers are being serviced for a while, then they may be delayed indefinitely.  NSNotificationQueue predates NSOperationQueue and GCD.  Back then, just about the only way to run code on the main thread was while servicing a run loop source or timer, so an NSPostASAP notification would in fact be delivered immediately after you let execution return to the framework.  However, now it's possible to run an operation or a block on the main thread, and I don't think those count as run loop sources or timers.

Regards,
Ken

_______________________________________________

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: Asynchronous Notification Does NOT Work
      • From: Bing Li <email@hidden>
References: 
 >Asynchronous Notification Does NOT Work (From: Bing Li <email@hidden>)

  • Prev by Date: Re: [ANN] CoreParse
  • Next by Date: Re: Asynchronous Notification Does NOT Work
  • Previous by thread: Re: Asynchronous Notification Does NOT Work
  • Next by thread: Re: Asynchronous Notification Does NOT Work
  • Index(es):
    • Date
    • Thread