• 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: Background Process?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Background Process?


  • Subject: Re: Background Process?
  • From: Kyle Sluder <email@hidden>
  • Date: Wed, 11 Mar 2009 11:43:19 -0400

On Wed, Mar 11, 2009 at 2:42 AM, Ken Thomases <email@hidden> wrote:
> There is, in fact, no need for a dummy input source.  A timer is sufficient
> to keep a run loop "running", which is to say blocked.  I was one of the
> incorrect folks who propagated this myth, unfortunately, but was corrected.
>  Either a dummy input source such as a port _or_ a timer is enough to keep a
> run loop -run... method from immediately exiting.

And taken in context with the rest of the statements about how timers
aren't input sources, this didn't make sense to me.

> Although these details should not be relied upon, under the hood a run loop
> is implemented in terms of Mach message ports.  A run loop blocks by calling
> mach_msg() to receive a Mach message on any of a set of ports.  If there are
> timers in the run loop mode, then the time interval until the next needs to
> fire is passed as a timeout to the mach_msg() call.  This is how a run loop
> can block waiting for any source or timer.  (If sources or timers are added
> from another thread, which is legal with CFRunLoop but not NSRunLoop, then
> the other thread needs to wake the run loop, probably by sending a message
> on a Mach port set aside for that specific purpose.  That port will be in
> the set being waited on in mach_msg(), thus unblocking it.)

And there we have it.  Thank you very much for clearing up this rather
significant confusion on my part.  Sorry to everyone else for wasting
your time.

--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

  • Follow-Ups:
    • Re: Background Process?
      • From: Shawn Erickson <email@hidden>
References: 
 >Background Process? (From: Pierce Freeman <email@hidden>)
 >Re: Background Process? (From: Chris Suter <email@hidden>)
 >Re: Background Process? (From: Darren Minifie <email@hidden>)
 >Re: Background Process? (From: Michael Ash <email@hidden>)
 >Re: Background Process? (From: Kyle Sluder <email@hidden>)
 >Re: Background Process? (From: Roland King <email@hidden>)
 >Re: Background Process? (From: Kyle Sluder <email@hidden>)
 >Re: Background Process? (From: Chris Suter <email@hidden>)
 >Re: Background Process? (From: Kyle Sluder <email@hidden>)
 >Re: Background Process? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSSlider changed notification
  • Next by Date: Re: Synthesized instance variables
  • Previous by thread: Re: Background Process?
  • Next by thread: Re: Background Process?
  • Index(es):
    • Date
    • Thread