protected:
virtual IOReturn _maintRequest(void *command, void *data, void *, void *);
public:
virtual IOReturn addEventSource(IOEventSource *newEvent);
Add an event source to be monitored by the work loop. This function does not return until the work loop has acknowledged the arrival of the new event source. When a new event has been added the threadMain will always restart it's loop and check all outstanding events. The event source is retained by the work loop
Result: Always returns kIOReturnSuccess.
Name Description newEvent Pointer to $link IOEventSource subclass to add.
public:
virtual void closeGate();
public:
virtual void disableAllEventSources() const;
For all event sources in $link eventChain call disable() function. See $link IOEventSource::disable()
public:
virtual void disableAllInterrupts() const;
For all event sources, ES, for which IODynamicCast(IOInterruptEventSource, ES) is valid, in $link eventChain call disable() function. See $link IOEventSource::disable()
public:
virtual void enableAllEventSources() const;
For all event sources in $link eventChain call enable() function. See $link IOEventSource::enable()
public:
virtual void enableAllInterrupts() const;
For all event sources, ES, for which IODynamicCast(IOInterruptEventSource, ES) is valid, in $link eventChain call enable() function. See $link IOEventSource::enable()
protected:
virtual void free();
Mandatory free of the object independent of the current retain count. If the work loop is running this method will not return until the thread has succefully terminated. Each event source in the chain will be released and the working semaphore will be destroyed.
If the client has some outstanding requests on an event they will never be informed of completion. If an external thread is blocked on any of the event sources they will be awoken with a KERN_INTERUPTED status.
public:
virtual void signalWorkAvailable();
Result: Returns workThreadpublic:
virtual IOThread getThread() const;
Result: Returns true if IOThreadSelf() is gate holder.public:
virtual bool inGate() const;
Result: true if initialised successfully, false otherwise.public:
virtual bool init();
private:
static void launchThreadMain(void *self);
Result: Returns true if IOThreadSelf() == workThread.public:
virtual bool onThread() const;
public:
virtual void openGate();
public:
virtual IOReturn removeEventSource(IOEventSource *toRemove);
Remove an event source from the work loop. This function does not return until the work loop has acknowledged the removal of the event source. When an event has been removed the threadMain will always restart it's loop and check all outstanding events. The event source will be released before return.
Result: kIOReturnSuccess if successful, kIOReturnBadArgument if toRemove couldn't be found.
Name Description toRemove Pointer to $link IOEventSource subclass to remove.
protected:
virtual void threadMain();
Work loop threads main function. This function consists of 3 loops: the outermost loop is the semaphore clear and wait loop, the middle loop terminates when there is no more work and the inside loop walks the event list calling the $link checkForWork method in each event source. If an event source has more work to do then it can set the more flag and the middle loop will repeat. When no more work is outstanding the outermost will sleep until and event is signaled or the least wakeupTime whichever occurs first. If the event source does not require the semaphore wait to time out it must set the provided wakeupTime parameter to zero.
Result: workLoop instance if constructed successfully, 0 otherwise.public:
static IOWorkLoop *workLoop();
protected:IOCommandGate *controlG;
Internal control gate to maintain event system.
protected:IOEventSource *eventChain;
Pointer to first Event Source in linked list.
protected:IORecursiveLock *gateLock;
Mutual exlusion lock that used by close and open Gate functions.
protected:bool loopRestart;
If event chain has been changed and the system has to be rechecked from start this flag is set. (Internal use only)
protected:typedef enum { mAddEvent, mRemoveEvent } maintCommandEnum;
Enumeration of commands that $link _maintCommand can deal with.
protected:semaphore_port_t workSemaphore;
The semaphore that is used to signal the work loop when some event has been 'produced'.
protected:IOThread workThread;
Work loop thread.
© 2000 Apple Computer, Inc. (Last Updated 2/23/2000)