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.
33 * Multiprocessor locks used within the shared memory area between the
34 * kernel and event system. These must work in both user and kernel mode.
36 * These routines are public, for the purpose of writing frame buffer device
37 * drivers which handle their own cursors. Certain architectures define a
38 * generic display class which handles cursor drawing and is subclassed by
39 * driver writers. These drivers need not be concerned with the following
40 * types and definitions.
42 * The ev_lock(), ev_unlock(), and ev_try_lock() functions are available only
43 * to drivers built in or dynamically loaded into the kernel, and to DPS
44 * drivers built in or dynamically loaded into the Window Server. They do not
45 * exist in any shared library.
47 * --> They're now in IOKit user lib.
50 #ifndef _IOKIT_IOSHAREDLOCK_H
51 #define _IOKIT_IOSHAREDLOCK_H
57 // should be 32 bytes on PPC
58 typedef volatile int IOSharedLockData
;
59 typedef IOSharedLockData
* IOSharedLock
;
61 #define IOSpinLockInit(l) (*(l) = (IOSpinLockData)0)
63 extern void IOSpinLock(IOSharedLock l
);
64 extern void IOSpinUnlock(IOSharedLock l
);
65 extern boolean_t
IOTrySpinLock(IOSharedLock l
);
67 /* exact same stuff & implementation */
69 typedef IOSharedLockData ev_lock_data_t
;
70 typedef ev_lock_data_t
* ev_lock_t
;
72 #define ev_init_lock(l) (*(l) = (ev_lock_data_t)0)
74 //#define ev_is_locked(l) (*(l) != (ev_lock_data_t)0)
76 extern void ev_lock(ev_lock_t l
); // Spin lock!
77 extern void ev_unlock(ev_lock_t l
);
78 extern boolean_t
ev_try_lock(ev_lock_t l
);
83 #endif /* ! _IOKIT_IOSHAREDLOCK_H */