protected:
virtual bool checkForWork() = 0;
This function will be called to request a subclass to check it's internal state for any work to do and then to call out the owner/action.
Result: Return true if this function needs to be called again before all its outstanding events have been processed.public:
virtual void disable();
A subclass implementation is expected to respect the enabled state when checkForWork is called.
public:
virtual void enable();
A subclass implementation is expected to respect the enabled state when checkForWork is called. Calling this function will cause the work-loop to be signalled so that a checkForWork is performed.
Result: value of action.public:
virtual IOEventSource::Action getAction() const;
Result: value of eventChainNext.protected:
virtual IOEventSource *getNext() const;
Result: value of workLoop.public:
virtual IOWorkLoop *getWorkLoop() const;
protected:
virtual bool init(OSObject *owner, IOEventSource::Action action = 0);
Result: true if the inherited classes and this instance initialise successfully.
Name Description owner Owner of this instance of an event source. Used as the first parameter of the action callout. Owner will generally be an OSObject it doesn't have to be as no member functions will be called directly in it. It can just be a refcon for a client routine. action Pointer to C call out function. Action is a pointer to a C function that gets called when this event source has outstanding work. It will usually be called by the checkForWork member function. The first parameter of the action call out will always be the owner, this allows C++ member functions to be used as actions. Defaults to 0.
Result: true if enabled.public:
virtual bool isEnabled() const;
Result: true if called on the work-loop thread.public:
virtual bool onThread() const;
public:
virtual void setAction(IOEventSource::Action action);
Name Description action Pointer to a C function of type IOEventSource::Action.
protected:
virtual void setNext(IOEventSource *next);
Name Description next Pointer to another IOEventSource instance.
protected:
virtual void setWorkLoop(IOWorkLoop *workLoop);
Name Description workLoop Target work-loop of this event source instance. A subclass of IOWorkLoop that at least reacts to signalWorkAvailable() and onThread functions.
public:typedef void (*Action)(OSObject *owner, ...);
Placeholder type for C++ function overloading discrimination. As the all event sources require an action and it has to be stored somewhere and be of some type, this is that type.
Name Description owner Target of the function, can be used as a refcon. The owner is set during initialisation. Note if a C++ function was specified this parameter is implicitly the first paramter in the target member function's parameter list.
protected:Action action;
The action method called when an event has been delivered
protected:bool enabled;
Is this event source enabled to deliver requests to the work-loop.
protected:IOEventSource *eventChainNext;
The next event source in the event chain. nil at end of chain.
protected:OSObject *owner;
The owner object called when an event has been delivered.
protected:void *refcon;
What ever the client wants to do, see $link setRefcon.
protected:IOWorkLoop *workLoop;
What is the work-loop for this event source.
#define IOEventSourceAction IOEventSource::Action
Backward compatibilty define for the old non-class scoped type definition. See $link IOEventSource::Action
© 2000 Apple Computer, Inc. (Last Updated 2/23/2000)