Annotation of OSKit-Mach/ipc/ipc_thread.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Mach Operating System
        !             3:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University.
        !             4:  * Copyright (c) 1993,1994 The University of Utah and
        !             5:  * the Computer Systems Laboratory (CSL).
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Permission to use, copy, modify and distribute this software and its
        !             9:  * documentation is hereby granted, provided that both the copyright
        !            10:  * notice and this permission notice appear in all copies of the
        !            11:  * software, derivative works or modified versions, and any portions
        !            12:  * thereof, and that both notices appear in supporting documentation.
        !            13:  *
        !            14:  * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
        !            15:  * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
        !            16:  * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
        !            17:  * THIS SOFTWARE.
        !            18:  *
        !            19:  * Carnegie Mellon requests users of this software to return to
        !            20:  *
        !            21:  *  Software Distribution Coordinator  or  [email protected]
        !            22:  *  School of Computer Science
        !            23:  *  Carnegie Mellon University
        !            24:  *  Pittsburgh PA 15213-3890
        !            25:  *
        !            26:  * any improvements or extensions that they make and grant Carnegie Mellon
        !            27:  * the rights to redistribute these changes.
        !            28:  */
        !            29: /*
        !            30:  */
        !            31: /*
        !            32:  *     File:   ipc/ipc_thread.c
        !            33:  *     Author: Rich Draves
        !            34:  *     Date:   1989
        !            35:  *
        !            36:  *     IPC operations on threads.
        !            37:  */
        !            38: 
        !            39: #include <kern/assert.h>
        !            40: #include <ipc/ipc_thread.h>
        !            41: 
        !            42: /*
        !            43:  *     Routine:        ipc_thread_enqueue
        !            44:  *     Purpose:
        !            45:  *             Enqueue a thread.
        !            46:  */
        !            47: 
        !            48: void
        !            49: ipc_thread_enqueue(
        !            50:        ipc_thread_queue_t      queue,
        !            51:        ipc_thread_t            thread)
        !            52: {
        !            53:        ipc_thread_enqueue_macro(queue, thread);
        !            54: }
        !            55: 
        !            56: /*
        !            57:  *     Routine:        ipc_thread_dequeue
        !            58:  *     Purpose:
        !            59:  *             Dequeue and return a thread.
        !            60:  */
        !            61: 
        !            62: ipc_thread_t
        !            63: ipc_thread_dequeue(
        !            64:        ipc_thread_queue_t      queue)
        !            65: {
        !            66:        ipc_thread_t first;
        !            67: 
        !            68:        first = ipc_thread_queue_first(queue);
        !            69: 
        !            70:        if (first != ITH_NULL)
        !            71:                ipc_thread_rmqueue_first_macro(queue, first);
        !            72: 
        !            73:        return first;
        !            74: }
        !            75: 
        !            76: /*
        !            77:  *     Routine:        ipc_thread_rmqueue
        !            78:  *     Purpose:
        !            79:  *             Pull a thread out of a queue.
        !            80:  */
        !            81: 
        !            82: void
        !            83: ipc_thread_rmqueue(
        !            84:        ipc_thread_queue_t      queue,
        !            85:        ipc_thread_t            thread)
        !            86: {
        !            87:        ipc_thread_t next, prev;
        !            88: 
        !            89:        assert(queue->ithq_base != ITH_NULL);
        !            90: 
        !            91:        next = thread->ith_next;
        !            92:        prev = thread->ith_prev;
        !            93: 
        !            94:        if (next == thread) {
        !            95:                assert(prev == thread);
        !            96:                assert(queue->ithq_base == thread);
        !            97: 
        !            98:                queue->ithq_base = ITH_NULL;
        !            99:        } else {
        !           100:                if (queue->ithq_base == thread)
        !           101:                        queue->ithq_base = next;
        !           102: 
        !           103:                next->ith_prev = prev;
        !           104:                prev->ith_next = next;
        !           105:                ipc_thread_links_init(thread);
        !           106:        }
        !           107: }

unix.superglobalmegacorp.com

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