Annotation of XNU/iokit/IOKit/IOSharedLock.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1998-2000 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) 1998 Apple Computer, Inc.  All rights reserved. 
        !            24:  *
        !            25:  * HISTORY
        !            26:  *
        !            27:  */
        !            28: 
        !            29: /*
        !            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.
        !            32:  * 
        !            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.
        !            38:  *
        !            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.
        !            43:  *
        !            44:  * --> They're now in IOKit user lib.
        !            45:  */
        !            46: 
        !            47: #ifndef _IOKIT_IOSHAREDLOCK_H
        !            48: #define _IOKIT_IOSHAREDLOCK_H
        !            49: 
        !            50: #ifdef __cplusplus
        !            51: extern "C" {
        !            52: #endif
        !            53: 
        !            54: // should be 32 bytes on PPC
        !            55: typedef volatile int           IOSharedLockData;
        !            56: typedef IOSharedLockData    *   IOSharedLock;
        !            57: 
        !            58: #define IOSpinLockInit(l)      (*(l) = (IOSpinLockData)0)
        !            59: 
        !            60: extern void IOSpinLock(IOSharedLock l);
        !            61: extern void IOSpinUnlock(IOSharedLock l);
        !            62: extern boolean_t IOTrySpinLock(IOSharedLock l);
        !            63: 
        !            64: /* exact same stuff & implementation */
        !            65: 
        !            66: typedef IOSharedLockData       ev_lock_data_t;
        !            67: typedef ev_lock_data_t     *   ev_lock_t;
        !            68: 
        !            69: #define ev_init_lock(l)                (*(l) = (ev_lock_data_t)0)
        !            70: // needs isync?
        !            71: //#define ev_is_locked(l)      (*(l) != (ev_lock_data_t)0)
        !            72: 
        !            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);
        !            76: 
        !            77: #ifdef __cplusplus
        !            78: }
        !            79: #endif
        !            80: #endif /* ! _IOKIT_IOSHAREDLOCK_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.