52 @discussion An IOWorkLoop is a thread of control that is intended to be used to provide single threaded access to hardware. This class has no knowledge of the nature and type of the events that it marshals and forwards. When a device driver successfully starts (see IOService::start), it is expected to create the event sources it will need to receive events. Then a work loop is initialized and the events are added to the work loop for monitoring. In general this set up will be automated by the family superclass of the specific device.
54 The thread main method walks the event source linked list and messages each one requesting a work check. At this point each event source is expected to notify its registered owner that the event has occurred. After each event has been walked and each indicates that another loop isn't required (by setting the 'more' flag to false) the thread will go to sleep on a signaling semaphore.
101 Mutual exclusion lock that is used by close and open Gate functions.
102 This is a recursive lock, which allows multiple layers of code to share a single IOWorkLoop without deadlock. This is common in IOKit since threads of execution tend to follow the service plane in the IORegistry, and multiple objects along the call path may acquire the gate for the same (shared) workloop.
149 @abstract Synchronous implementation of addEventSource and removeEventSource functions.
150 @discussion This function implements the commands as defined in the maintCommandEnum. It can be subclassed but it isn't an external API in the usual sense. A subclass implementation of _maintRequest would be called synchronously with respect to the work loop and it should be implemented in the usual way that an ioctl would be.
151 @return kIOReturnUnsupported if the command given is not implemented, kIOReturnSuccess otherwise.
156 @discussion 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 successfully terminated. Each event source in the chain will be released and the working semaphore will be destroyed.
158 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 awakened with a KERN_INTERUPTED status.
189 @discussion Initializes an instance of the workloop. This method creates and initializes the signaling semaphore, the controller gate lock, and spawns the thread that will continue executing.
190 @result Returns true if initialized successfully, false otherwise.
213 @discussion 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 its loop and check all outstanding events. The event source is retained by the work loop.
214 @param newEvent Pointer to IOEventSource subclass to add.
220 @discussion 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 its loop and check all outstanding events. The event source will be released before return.
221 @param toRemove Pointer to IOEventSource subclass to remove.
222 @result Returns kIOReturnSuccess if successful, kIOReturnBadArgument if toRemove couldn't be found.
239 @abstract Calls enable() in all interrupt event sources.
240 @discussion For all event sources (ES) for which IODynamicCast(IOInterruptEventSource, ES) is valid, in eventChain call enable() function. See IOEventSource::enable().
245 @abstract Calls disable() in all interrupt event sources.
246 @discussion For all event sources (ES) for which IODynamicCast(IOInterruptEventSource, ES) is valid, in eventChain call disable() function. See IOEventSource::disable().
266 @abstract Single thread a call to an action with the work-loop.
267 @discussion Client function that causes the given action to be called in a single threaded manner. Beware: the work-loop's gate is recursive and runAction can cause direct or indirect re-entrancy. When executing on a client's thread, runAction will sleep until the work-loop's gate opens for execution of client actions, the action is single threaded against all other work-loop event sources.
268 @param action Pointer to function to be executed in work-loop context.
269 @param arg0 Parameter for action parameter, defaults to 0.
270 @param arg1 Parameter for action parameter, defaults to 0.
271 @param arg2 Parameter for action parameter, defaults to 0.
272 @param arg3 Parameter for action parameter, defaults to 0.
273 @result Returns the value of the Action callout.