]>
git.saurik.com Git - apple/xnu.git/blob - iokit/Kernel/IOEventSource.cpp
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
29 1998-7-13 Godfrey van der Linden(gvdl)
32 #include <IOKit/IOLib.h>
34 #include <IOKit/IOEventSource.h>
35 #include <IOKit/IOWorkLoop.h>
37 #define super OSObject
39 OSDefineMetaClassAndAbstractStructors(IOEventSource
, OSObject
)
40 OSMetaClassDefineReservedUnused(IOEventSource
, 0);
41 OSMetaClassDefineReservedUnused(IOEventSource
, 1);
42 OSMetaClassDefineReservedUnused(IOEventSource
, 2);
43 OSMetaClassDefineReservedUnused(IOEventSource
, 3);
44 OSMetaClassDefineReservedUnused(IOEventSource
, 4);
45 OSMetaClassDefineReservedUnused(IOEventSource
, 5);
46 OSMetaClassDefineReservedUnused(IOEventSource
, 6);
47 OSMetaClassDefineReservedUnused(IOEventSource
, 7);
49 /* inline function implementations */
50 void IOEventSource::signalWorkAvailable() { workLoop
->signalWorkAvailable(); }
51 void IOEventSource::openGate() { workLoop
->openGate(); }
52 void IOEventSource::closeGate() { workLoop
->closeGate(); }
53 bool IOEventSource::tryCloseGate() { return workLoop
->tryCloseGate(); }
54 int IOEventSource::sleepGate(void *event
, UInt32 type
)
55 { return workLoop
->sleepGate(event
, type
); }
56 void IOEventSource::wakeupGate(void *event
, bool oneThread
)
57 { workLoop
->wakeupGate(event
, oneThread
); }
59 bool IOEventSource::init(OSObject
*inOwner
,
70 (void) setAction(inAction
);
76 IOEventSource::Action
IOEventSource::getAction () const { return action
; };
78 void IOEventSource::setAction(Action inAction
)
83 IOEventSource
*IOEventSource::getNext() const { return eventChainNext
; };
85 void IOEventSource::setNext(IOEventSource
*inNext
)
87 eventChainNext
= inNext
;
90 void IOEventSource::enable()
94 return signalWorkAvailable();
97 void IOEventSource::disable()
102 bool IOEventSource::isEnabled() const
107 void IOEventSource::setWorkLoop(IOWorkLoop
*inWorkLoop
)
111 workLoop
= inWorkLoop
;
114 IOWorkLoop
*IOEventSource::getWorkLoop() const
119 bool IOEventSource::onThread() const
121 return (workLoop
!= 0) && workLoop
->onThread();