Up
Authors
- Andrew Kachites McCallum (
mccallum@gnu.ai.mit.edu
)
-
- Richard Frith-Macdonald (
richard@brainstorm.co.uk
)
-
Version: 27610
Date: 2009-01-16 13:35:03 +0000 (Fri, 16 Jan 2009)
Copyright: (C) 1996-1999 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSRunLoop.h
Availability: OpenStep
NSRunLoop
instances handle various
utility tasks that must be performed repetitively
in an application, such as processing input events,
listening for distributed objects communications,
firing
NSTimer
s, and sending notifications and other messages
asynchronously.
In general, there is one run loop per thread in an
application, which may always be obtained
through the
+currentRunLoop
method, however unless you are using the AppKit
and the
NSApplication
class, the run loop will not be started unless
you explicitly send it a
-run
message.
At any given point, a run loop operates in a single
mode, usually
NSDefaultRunLoopMode
. Other options
include NSConnectionReplyMode
, and
certain modes used by the AppKit.
Method summary
+ (
NSRunLoop*)
currentRunLoop;
Availability: OpenStep
Returns the run loop instance for the current
thread.
- (void)
acceptInputForMode: (
NSString*)mode
beforeDate: (
NSDate*)limit_date;
Availability: OpenStep
Listen for events from input sources.
If
limit_date is nil
or in the
past, then don't wait; just poll inputs and return,
otherwise block until input is available or until
the earliest limit date has passed (whichever comes
first).
If the supplied mode is
nil
, uses NSDefaultRunLoopMode.
If there are no input sources in the mode,
returns immediately.
- (void)
addTimer: (
NSTimer*)timer
forMode: (
NSString*)mode;
Availability: OpenStep
Adds a timer to the loop in the specified
mode.
Timers are removed
automatically when they are invalid.
- (
NSString*)
currentMode;
Availability: OpenStep
Returns the current mode of this runloop. If the
runloop is not running then this method returns
nil
.
- (
NSDate*)
limitDateForMode: (
NSString*)mode;
Availability: OpenStep
Fires timers whose fire date has passed, and checks
timers and limit dates for input sources,
determining the earliest time that any future
timeout becomes due. Returns that date/time.
- (void)
run;
Availability: OpenStep
Runs the loop in
NSDefaultRunLoopMode
by
repeated calls to
-runMode:beforeDate:
while there are still input sources. Exits when no
more input sources remain.
- (BOOL)
runMode: (
NSString*)mode
beforeDate: (
NSDate*)date;
Availability: OpenStep
Calls
-limitDateForMode:
to determine if a timeout occurs before the specified
date, then calls
-acceptInputForMode:beforeDate:
to run the loop once.
The specified
date may be
nil
... in which
case the loop runs until the limit
date of
the first input or timeout.
If the specified
date is in the past, this runs the loop
once only, to handle any events already available.
If there are no input sources in
mode, returns
NO
without
running the loop, otherwise returns
YES
.
- (void)
runUntilDate: (
NSDate*)date;
Availability: OpenStep
Runs the loop in
NSDefaultRunLoopMode
by
repeated calls to
-runMode:beforeDate:
while there are still input sources. Exits when no
more input sources remain, or
date is
reached, whichever occurs first.
- Declared in:
- Foundation/NSRunLoop.h
Availability: OpenStep
Description forthcoming.
Method summary
- (BOOL)
runLoopShouldBlock: (BOOL*)shouldTrigger;
Availability: OpenStep
Description forthcoming.
- Declared in:
- Foundation/NSRunLoop.h
Availability: OpenStep
Description forthcoming.
Method summary
- (void)
removeEvent: (void*)data
type: (
RunLoopEventType)type
forMode: (
NSString*)mode
all: (BOOL)removeAll;
Availability: OpenStep
Description forthcoming.
- Declared in:
- Foundation/NSRunLoop.h
Availability: OpenStep
OpenStep-compatibility methods for
NSRunLoop
. These methods are also all in OS X.
Method summary
- (void)
addPort: (
NSPort*)port
forMode: (
NSString*)mode;
Availability: OpenStep
Adds port to be monitored in given
mode.
- (void)
cancelPerformSelector: (SEL)aSelector
target: (id)target
argument: (id)argument;
Availability: OpenStep
Cancels any perform operations set up for the
specified
target in the receiver, but
only if the value of
aSelector and
argument with which the performs were set
up match those supplied.
Matching of the
argument may be either by pointer equality
or by use of the
[NSObject -isEqual:]
method.
- (void)
cancelPerformSelectorsWithTarget: (id)target;
Availability: OpenStep
Cancels any perform operations set up for the
specified target in the receiver.
- (void)
configureAsServer;
Availability: OpenStep
Configure event processing for acting as a server
process for distributed objects. (In the current
implementation this is a no-op.)
- (void)
performSelector: (SEL)aSelector
target: (id)target
argument: (id)argument
order: (unsigned int)order
modes: (
NSArray*)modes;
Availability: OpenStep
Sets up sending of aSelector to
target with argument.
The selector is sent before the next runloop iteration
(unless cancelled before then) in any of the
specified modes.
The
target and argument objects are
retained.
The order value is
used to determine the order in which
messages are sent if multiple messages have been
set up. Messages with a lower order value
are sent first.
If the modes array is
empty, this method has no effect.
- (void)
removePort: (
NSPort*)port
forMode: (
NSString*)mode;
Availability: OpenStep
Removes port to be monitored from given
mode. Ports are also removed if they are
detected to be invalid.
- Declared in:
- Foundation/NSRunLoop.h
Availability: OpenStep
Description forthcoming.
Method summary
- (void)
receivedEvent: (void*)data
type: (
RunLoopEventType)type
extra: (void*)extra
forMode: (
NSString*)mode;
Availability: OpenStep
Description forthcoming.
Up