1/* 2 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * The contents of this file constitute Original Code as defined in and 7 * are subject to the Apple Public Source License Version 1.1 (the 8 * "License"). You may not use this file except in compliance with the 9 * License. Please obtain a copy of the License at 10 * http://www.apple.com/publicsource and read it before using this file. 11 * 12 * This Original Code and all software distributed under the License are 13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17 * License for the specific language governing rights and limitations 18 * under the License. 19 * 20 * @APPLE_LICENSE_HEADER_END@ 21 */ 22/* 23 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved. 24 * 25 * HISTORY 26 * 27 */ 28 29 30#ifndef _IOKIT_IOFWWORKLOOP_H 31#define _IOKIT_IOFWWORKLOOP_H 32 33#include <IOKit/IOWorkLoop.h> 34#include <libkern/c++/OSSet.h> 35 36class IOFWWorkLoop : public IOWorkLoop 37{ 38 OSDeclareDefaultStructors(IOFWWorkLoop) 39 40protected: 41 void * fSleepToken; 42 static SInt32 sLockGroupCount; 43 lck_grp_t * fLockGroup; 44 45 IOThread fRemoveSourceThread; 46 OSSet * fRemoveSourceDeferredSet; 47 48 bool init( void ); 49 void free( void ); 50 51 // Overrides to check for sleeping 52 virtual void closeGate(); 53 virtual bool tryCloseGate(); 54 55public: 56 // Create a workloop 57 static IOFWWorkLoop * workLoop(); 58 59 // Put workloop to sleep (Must have gate closed, opens gate if successful) 60 virtual IOReturn sleep( void *token ); 61 62 // Wake workloop up (closes gate if successful) 63 virtual IOReturn wake( void *token ); 64 65 virtual IOReturn removeEventSource(IOEventSource *toRemove); 66 67}; 68 69#endif /* ! _IOKIT_IOFWWORKLOOP_H */ 70 71