/*
- * Copyright (c) 1998-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2009 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-/*
-Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
-HISTORY
- 1998-7-13 Godfrey van der Linden(gvdl)
- Created.
- 1998-10-30 Godfrey van der Linden(gvdl)
- Converted to C++
-*/
#ifndef __IOKIT_IOWORKLOOP_H
#define __IOKIT_IOWORKLOOP_H
#include <IOKit/system.h>
+#if IOKITSTATS
+#include <IOKit/IOStatisticsPrivate.h>
+#endif
+
class IOEventSource;
class IOTimerEventSource;
class IOCommandGate;
@abstract Static function that calls the threadMain function.
*/
static void threadMainContinuation(IOWorkLoop *self);
-
+
+/*! @function eventSourcePerformsWork
+ @abstract Checks if the event source passed in overrides checkForWork() to perform any work.
+IOWorkLoop uses this to determine if the event source should be polled in runEventSources() or not.
+ @param inEventSource The event source to check.
+*/
+ bool eventSourcePerformsWork(IOEventSource *inEventSource);
+
protected:
/*! @typedef maintCommandEnum
*/
struct ExpansionData {
IOOptionBits options;
+ IOEventSource *passiveEventChain;
+#if DEBUG
+ void * allocationBacktrace[16];
+#endif /* DEBUG */
+#if IOKITSTATS
+ struct IOWorkLoopCounter *counter;
+#else
+ void *iokitstatsReserved;
+#endif
};
/*! @var reserved
/*! @function enableAllInterrupts
@abstract Calls enable() in all interrupt event sources.
- @discussion For all event sources (ES) for which IODynamicCast(IOInterruptEventSource, ES) is valid, in eventChain call enable() function. See IOEventSource::enable().
+ @discussion For all event sources (ES) for which OSDynamicCast(IOInterruptEventSource, ES) is valid, in eventChain call enable() function. See IOEventSource::enable().
*/
virtual void enableAllInterrupts() const;
/*! @function disableAllInterrupts
@abstract Calls disable() in all interrupt event sources.
- @discussion For all event sources (ES) for which IODynamicCast(IOInterruptEventSource, ES) is valid, in eventChain call disable() function. See IOEventSource::disable().
+ @discussion For all event sources (ES) for which OSDynamicCast(IOInterruptEventSource, ES) is valid, in eventChain call disable() function. See IOEventSource::disable().
*/
virtual void disableAllInterrupts() const;
// Internal APIs used by event sources to control the thread
friend class IOEventSource;
friend class IOTimerEventSource;
+#if IOKITSTATS
+ friend class IOStatistics;
+#endif
virtual void signalWorkAvailable();
virtual void openGate();
virtual void closeGate();
@param arg3 Parameter for action parameter, defaults to 0.
@result Returns the value of the Action callout.
*/
- OSMetaClassDeclareReservedUsed(IOWorkLoop, 0);
virtual IOReturn runAction(Action action, OSObject *target,
void *arg0 = 0, void *arg1 = 0,
void *arg2 = 0, void *arg3 = 0);
@result Return false if the work loop is shutting down, true otherwise.
*/
- OSMetaClassDeclareReservedUsed(IOWorkLoop, 1);
virtual bool runEventSources();
protected:
+ // Internal APIs used by event sources to control the thread
+ virtual int sleepGate(void *event, AbsoluteTime deadline, UInt32 interuptibleType);
+protected:
+#if __LP64__
+ OSMetaClassDeclareReservedUnused(IOWorkLoop, 0);
+ OSMetaClassDeclareReservedUnused(IOWorkLoop, 1);
OSMetaClassDeclareReservedUnused(IOWorkLoop, 2);
+#else
+ OSMetaClassDeclareReservedUsed(IOWorkLoop, 0);
+ OSMetaClassDeclareReservedUsed(IOWorkLoop, 1);
+ OSMetaClassDeclareReservedUsed(IOWorkLoop, 2);
+#endif
OSMetaClassDeclareReservedUnused(IOWorkLoop, 3);
OSMetaClassDeclareReservedUnused(IOWorkLoop, 4);
OSMetaClassDeclareReservedUnused(IOWorkLoop, 5);