Provides two controls (interrupted and manuallySuspended) for suspending a slave object, and also propagates such control messages to interested listeners. More...
#import <OALSuspendHandler.h>
Instance Methods | |
| (id) | - initWithTarget:selector: |
| Initialize a handler with the specified slave target and selector. More... | |
| (void) | - addSuspendListener: |
| Add a listener that will receive manual suspend and interrupt events. More... | |
| (void) | - removeSuspendListener: |
| Remove a registered listener. More... | |
Class Methods | |
| (OALSuspendHandler *) | + handlerWithTarget:selector: |
| Create a new handler with the specified slave target and selector. More... | |
Protected Attributes | |
| NSMutableArray * | listeners |
| Listeners that will receive manualSuspend and interrupt events. More... | |
| NSMutableArray * | manualSuspendStates |
| Holder for the state of manualSuspend in listeners when this object is manually suspended. More... | |
| SEL | suspendStatusChangeSelector |
| Selector to be invoked on suspend or unsuspend. More... | |
| bool | manualSuspendLock |
| Holds the current "manually suspended" state. More... | |
| bool | interruptLock |
| Holds the current "interrupted" state. More... | |
Properties | |
| bool | manuallySuspended |
| If YES, the manual suspend control is set. More... | |
| bool | interrupted |
| If YES, the interrupt control is set. More... | |
| bool | suspended |
| If YES, the slave object is suspended. More... | |
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.
| - (void) addSuspendListener: | (id<OALSuspendListener>) | listener |
Add a listener that will receive manual suspend and interrupt events.
| listener | The listener to register with this handler. |
| + (OALSuspendHandler *) handlerWithTarget: | (id) | target | |
| selector: | (SEL) | selector | |
Create a new handler with the specified slave target and selector.
The selector provided must take a single boolean value like so:
| target | The slave object that will receive suspend/unsuspend events. |
| selector | The selector for a "set suspended" method, taking a single boolean parameter. |
| - (id) initWithTarget: | (id) | target | |
| selector: | (SEL) | selector | |
Initialize a handler with the specified slave target and selector.
The selector provided must take a single boolean value like so:
| target | The slave object that will receive suspend/unsuspend events. |
| selector | The selector for a "set suspended" method, taking a single boolean parameter. |
| - (void) removeSuspendListener: | (id<OALSuspendListener>) | listener |
Remove a registered listener.
| listener | The listener to unregister from this handler. |
|
protected |
Holds the current "interrupted" state.
|
protected |
Listeners that will receive manualSuspend and interrupt events.
|
protected |
Holds the current "manually suspended" state.
|
protected |
Holder for the state of manualSuspend in listeners when this object is manually suspended.
|
protected |
Selector to be invoked on suspend or unsuspend.
Takes the signature: setSelected:(bool) value
|
readwritenonatomicassign |
If YES, the interrupt control is set.
|
readwritenonatomicassign |
If YES, the manual suspend control is set.
|
readnonatomicassign |
If YES, the slave object is suspended.
1.8.3.1