Annotation of kernel/kern/parallel.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /* 
        !            26:  * Mach Operating System
        !            27:  * Copyright (c) 1989 Carnegie-Mellon University
        !            28:  * Copyright (c) 1988 Carnegie-Mellon University
        !            29:  * Copyright (c) 1987 Carnegie-Mellon University
        !            30:  * All rights reserved.  The CMU software License Agreement specifies
        !            31:  * the terms and conditions for use and redistribution.
        !            32:  */
        !            33: 
        !            34: 
        !            35: #import <cpus.h>
        !            36: #import <mach_host.h>
        !            37: 
        !            38: #if    NCPUS > 1
        !            39: 
        !            40: #import <kern/processor.h>
        !            41: #import <kern/thread.h>
        !            42: #import <kern/sched_prim.h>
        !            43: #import <kern/parallel.h>
        !            44: 
        !            45: void unix_master()
        !            46: {
        !            47:        register thread_t t = current_thread();
        !            48:        
        !            49:        if (! (++( t->unix_lock )))     {
        !            50: 
        !            51:                /* thread_bind(t, master_processor); */
        !            52:                t->bound_processor = master_processor;
        !            53: 
        !            54:                if (cpu_number() != master_cpu) {
        !            55:                        t->interruptible = FALSE;
        !            56:                        thread_block();
        !            57:                }
        !            58:        }
        !            59: }
        !            60: 
        !            61: void unix_release()
        !            62: {
        !            63:        register thread_t t = current_thread();
        !            64: 
        !            65:        t->unix_lock--;
        !            66:        if (t->unix_lock < 0) {
        !            67:                /* thread_bind(t, PROCESSOR_NULL); */
        !            68:                t->bound_processor = PROCESSOR_NULL;
        !            69: #if    MACH_HOST
        !            70:                if (t->processor_set != &default_pset)
        !            71:                        thread_block();
        !            72: #endif MACH_HOST
        !            73:        }
        !            74: }
        !            75: 
        !            76: void unix_reset()
        !            77: {
        !            78:        register thread_t       t = current_thread();
        !            79: 
        !            80:        if (t->unix_lock != -1)
        !            81:                t->unix_lock = 0;
        !            82: }
        !            83: 
        !            84: #endif NCPUS > 1

unix.superglobalmegacorp.com

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