]>
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_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
32 1998-7-13 Godfrey van der Linden(gvdl)
35 #include <IOKit/IOLib.h>
37 #include <IOKit/IOEventSource.h>
38 #include <IOKit/IOWorkLoop.h>
40 #define super OSObject
42 OSDefineMetaClassAndAbstractStructors(IOEventSource
, OSObject
)
43 OSMetaClassDefineReservedUnused(IOEventSource
, 0);
44 OSMetaClassDefineReservedUnused(IOEventSource
, 1);
45 OSMetaClassDefineReservedUnused(IOEventSource
, 2);
46 OSMetaClassDefineReservedUnused(IOEventSource
, 3);
47 OSMetaClassDefineReservedUnused(IOEventSource
, 4);
48 OSMetaClassDefineReservedUnused(IOEventSource
, 5);
49 OSMetaClassDefineReservedUnused(IOEventSource
, 6);
50 OSMetaClassDefineReservedUnused(IOEventSource
, 7);
52 /* inline function implementations */
53 void IOEventSource::signalWorkAvailable() { workLoop
->signalWorkAvailable(); }
54 void IOEventSource::openGate() { workLoop
->openGate(); }
55 void IOEventSource::closeGate() { workLoop
->closeGate(); }
56 bool IOEventSource::tryCloseGate() { return workLoop
->tryCloseGate(); }
57 int IOEventSource::sleepGate(void *event
, UInt32 type
)
58 { return workLoop
->sleepGate(event
, type
); }
59 int IOEventSource::sleepGate(void *event
, AbsoluteTime deadline
, UInt32 type
)
60 { return workLoop
->sleepGate(event
, deadline
, type
); }
61 void IOEventSource::wakeupGate(void *event
, bool oneThread
)
62 { workLoop
->wakeupGate(event
, oneThread
); }
64 bool IOEventSource::init(OSObject
*inOwner
,
75 (void) setAction(inAction
);
81 IOEventSource::Action
IOEventSource::getAction () const { return action
; };
83 void IOEventSource::setAction(Action inAction
)
88 IOEventSource
*IOEventSource::getNext() const { return eventChainNext
; };
90 void IOEventSource::setNext(IOEventSource
*inNext
)
92 eventChainNext
= inNext
;
95 void IOEventSource::enable()
99 return signalWorkAvailable();
102 void IOEventSource::disable()
107 bool IOEventSource::isEnabled() const
112 void IOEventSource::setWorkLoop(IOWorkLoop
*inWorkLoop
)
116 workLoop
= inWorkLoop
;
119 IOWorkLoop
*IOEventSource::getWorkLoop() const
124 bool IOEventSource::onThread() const
126 return (workLoop
!= 0) && workLoop
->onThread();