The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/ipc/ipc_thread.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1993,1992,1991,1990,1989 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        ipc_thread.c,v $
   29  * Revision 2.7  93/11/17  17:03:00  dbg
   30  *      Added ANSI function prototypes.
   31  *      [93/07/12            dbg]
   32  * 
   33  * Revision 2.6  92/08/03  17:35:55  jfriedl
   34  *      removed silly prototypes
   35  *      [92/08/02            jfriedl]
   36  * 
   37  * Revision 2.5  92/05/21  17:12:02  jfriedl
   38  *      tried prototypes.
   39  *      [92/05/20            jfriedl]
   40  * 
   41  * Revision 2.4  91/05/14  16:38:05  mrt
   42  *      Correcting copyright
   43  * 
   44  * Revision 2.3  91/02/05  17:24:23  mrt
   45  *      Changed to new Mach copyright
   46  *      [91/02/01  15:52:29  mrt]
   47  * 
   48  * Revision 2.2  90/06/02  14:52:06  rpd
   49  *      Created for new IPC.
   50  *      [90/03/26  21:04:48  rpd]
   51  * 
   52  */
   53 /*
   54  *      File:   ipc/ipc_thread.c
   55  *      Author: Rich Draves
   56  *      Date:   1989
   57  *
   58  *      IPC operations on threads.
   59  */
   60 
   61 #include <ipc/ipc_thread.h>
   62 
   63 
   64 
   65 /*
   66  *      Routine:        ipc_thread_enqueue
   67  *      Purpose:
   68  *              Enqueue a thread.
   69  */
   70 
   71 void
   72 ipc_thread_enqueue(
   73         ipc_thread_queue_t queue,
   74         ipc_thread_t thread)
   75 {
   76         ipc_thread_enqueue_macro(queue, thread);
   77 }
   78 
   79 /*
   80  *      Routine:        ipc_thread_dequeue
   81  *      Purpose:
   82  *              Dequeue and return a thread.
   83  */
   84 
   85 ipc_thread_t
   86 ipc_thread_dequeue(
   87         ipc_thread_queue_t queue)
   88 {
   89         ipc_thread_t first;
   90 
   91         first = ipc_thread_queue_first(queue);
   92 
   93         if (first != ITH_NULL)
   94                 ipc_thread_rmqueue_first_macro(queue, first);
   95 
   96         return first;
   97 }
   98 
   99 /*
  100  *      Routine:        ipc_thread_rmqueue
  101  *      Purpose:
  102  *              Pull a thread out of a queue.
  103  */
  104 
  105 void
  106 ipc_thread_rmqueue(
  107         ipc_thread_queue_t queue,
  108         ipc_thread_t thread)
  109 {
  110         ipc_thread_t next, prev;
  111 
  112         assert(queue->ithq_base != ITH_NULL);
  113 
  114         next = thread->ith_next;
  115         prev = thread->ith_prev;
  116 
  117         if (next == thread) {
  118                 assert(prev == thread);
  119                 assert(queue->ithq_base == thread);
  120 
  121                 queue->ithq_base = ITH_NULL;
  122         } else {
  123                 if (queue->ithq_base == thread)
  124                         queue->ithq_base = next;
  125 
  126                 next->ith_prev = prev;
  127                 prev->ith_next = next;
  128                 ipc_thread_links_init(thread);
  129         }
  130 }

Cache object: 6fee4f67cf6c212f1b17942649df4e95


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.