< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is superseded by the information in Threading Programming Guide. For information about how to configure a run loop for your custom threads, see that document instead.


Adding Input Sources

In most cases, input source objects add themselves to the current run loop as needed, but you can add them manually to get greater control over their behavior.

The NSTimer class method scheduledTimerWithTimeInterval:invocation:repeats:, for example, creates a new timer object and adds it to the NSDefaultRunLoopMode mode of the current run loop. If you instead create the timer with timerWithTimeInterval:invocation:repeats:, you must add it manually to the run loop with the NSRunLoop instance method addTimer:forMode:, which allows you to specify a different mode.

NSPort objects are usually used as part of an NSConnection, which automatically adds its receive port to the appropriate modes as needed. If you have a stand-alone port object, you can manually add it to the run loop with the NSRunLoop method addPort:forMode:.



< Previous PageNext Page > Hide TOC


© 2001, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.