/*
- * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1998-2007 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
typedef IOReturn (*Action)(OSObject *target,
void *arg0, void *arg1,
void *arg2, void *arg3);
+ enum {
+ kPreciousStack = 0x00000001
+ };
private:
/*! @function threadMainContinuation
/*! @var gateLock
Mutual exclusion lock that is used by close and open Gate functions.
+ 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.
*/
IORecursiveLock *gateLock;
*/
IOCommandGate *controlG;
-/*! @var workSpinLock
+/*! @var workToDoLock
The spin lock that is used to guard the 'workToDo' variable.
*/
IOSimpleLock *workToDoLock;
/*! @struct ExpansionData
@discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.
*/
- struct ExpansionData { };
+ struct ExpansionData {
+ IOOptionBits options;
+ };
/*! @var reserved
Reserved for future use. (Internal use only)
public:
/*! @function workLoop
- @abstract Factory member function to constuct and intialize a work loop.
+ @abstract Factory member function to construct and intialize a work loop.
@result Returns a workLoop instance if constructed successfully, 0 otherwise.
*/
static IOWorkLoop *workLoop();
+/*! @function workLoopWithOptions(IOOptionBits options)
+ @abstract Factory member function to constuct and intialize a work loop.
+ @param options Options - kPreciousStack to avoid stack deallocation on paging path.
+ @result Returns a workLoop instance if constructed successfully, 0 otherwise.
+*/
+ static IOWorkLoop *workLoopWithOptions(IOOptionBits options);
+
/*! @function init
- @discussion Initializes an instance of the workloop. This method creates and initialses the signaling semaphore and forks the thread that will continue executing.
+ @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.
@result Returns true if initialized successfully, false otherwise.
*/
virtual bool init();
void *arg0 = 0, void *arg1 = 0,
void *arg2 = 0, void *arg3 = 0);
-#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT))
/*! @function runEventSources
@discussion Consists of the inner 2 loops of the threadMain function(qv).
The outer loop terminates when there is no more work, and the inside loop
*/
OSMetaClassDeclareReservedUsed(IOWorkLoop, 1);
virtual bool runEventSources();
-#endif
protected:
-#if (defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT))
- OSMetaClassDeclareReservedUnused(IOWorkLoop, 1);
-#endif
OSMetaClassDeclareReservedUnused(IOWorkLoop, 2);
OSMetaClassDeclareReservedUnused(IOWorkLoop, 3);
OSMetaClassDeclareReservedUnused(IOWorkLoop, 4);