Inherits from NSObject
Declared in OALSuspendHandler.h

Overview

Provides two controls (interrupted and manuallySuspended) for suspending a slave object, and also propagates such control messages to interested listeners.

“interrupted” is meant to be set by the system when an interrupt occurs.

“manuallySuspended” is a user-settable control for suspending an object.
“manuallySuspended” also has an extra step in its processing: When set, the handler makes a note of what its listeners' “manuallySuspended” values are. When cleared, it will only clear a listener’s “manuallySuspended” value if it was not set at suspend time. This allows for ad-hoc setting/clearing of “manuallySuspended” in the middle of a handler/listener graph rather than only from the top level.

When either control is set, the slave object will be suspended. When both are cleared, the slave object will be unsuspended.

Tasks

Properties

interrupted

If YES, the interrupt control is set.

@property (readwrite, assign) bool interrupted

Declared In

OALSuspendHandler.h

manuallySuspended

If YES, the manual suspend control is set.

@property (readwrite, assign) bool manuallySuspended

Declared In

OALSuspendHandler.h

suspended

If YES, the slave object is suspended.

@property (readonly) bool suspended

Declared In

OALSuspendHandler.h

Class Methods

handlerWithTarget:selector:

Create a new handler with the specified slave target and selector.

+ (OALSuspendHandler *)handlerWithTarget:(id)target selector:(SEL)selector

Parameters

target

The slave object that will receive suspend/unsuspend events.

selector

The selector for a “set suspended” method, taking a single boolean parameter.

Discussion

The selector provided must take a single boolean value like so:
– (void) setSuspended:(bool) value

Declared In

OALSuspendHandler.h

Instance Methods

addSuspendListener:

Add a listener that will receive manual suspend and interrupt events.

- (void)addSuspendListener:(id<OALSuspendListener>)listener

Parameters

listener

The listener to register with this handler.

Declared In

OALSuspendHandler.h

initWithTarget:selector:

Initialize a handler with the specified slave target and selector.

- (id)initWithTarget:(id)target selector:(SEL)selector

Parameters

target

The slave object that will receive suspend/unsuspend events.

selector

The selector for a “set suspended” method, taking a single boolean parameter.

Discussion

The selector provided must take a single boolean value like so:
– (void) setSuspended:(bool) value

Declared In

OALSuspendHandler.h

removeSuspendListener:

Remove a registered listener.

- (void)removeSuspendListener:(id<OALSuspendListener>)listener

Parameters

listener

The listener to unregister from this handler.

Declared In

OALSuspendHandler.h