2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
30 * Multiprocessor locks used within the shared memory area between the
31 * kernel and event system. These must work in both user and kernel mode.
33 * These routines are public, for the purpose of writing frame buffer device
34 * drivers which handle their own cursors. Certain architectures define a
35 * generic display class which handles cursor drawing and is subclassed by
36 * driver writers. These drivers need not be concerned with the following
37 * types and definitions.
39 * The ev_lock(), ev_unlock(), and ev_try_lock() functions are available only
40 * to drivers built in or dynamically loaded into the kernel, and to DPS
41 * drivers built in or dynamically loaded into the Window Server. They do not
42 * exist in any shared library.
44 * --> They're now in IOKit user lib.
47 #ifndef _IOKIT_IOSHAREDLOCK_H
48 #define _IOKIT_IOSHAREDLOCK_H
54 // should be 32 bytes on PPC
55 typedef volatile int IOSharedLockData
;
56 typedef IOSharedLockData
* IOSharedLock
;
58 #define IOSpinLockInit(l) (*(l) = (IOSpinLockData)0)
60 extern void IOSpinLock(IOSharedLock l
);
61 extern void IOSpinUnlock(IOSharedLock l
);
62 extern boolean_t
IOTrySpinLock(IOSharedLock l
);
64 /* exact same stuff & implementation */
66 typedef IOSharedLockData ev_lock_data_t
;
67 typedef ev_lock_data_t
* ev_lock_t
;
69 #define ev_init_lock(l) (*(l) = (ev_lock_data_t)0)
71 //#define ev_is_locked(l) (*(l) != (ev_lock_data_t)0)
73 extern void ev_lock(ev_lock_t l
); // Spin lock!
74 extern void ev_unlock(ev_lock_t l
);
75 extern boolean_t
ev_try_lock(ev_lock_t l
);
80 #endif /* ! _IOKIT_IOSHAREDLOCK_H */