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

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

Version: -  FREEBSD  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  cheribsd  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1  -  FREEBSD-LIBC  -  FREEBSD8-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 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.h,v $
   29  * Revision 2.4  91/05/14  16:38:20  mrt
   30  *      Correcting copyright
   31  * 
   32  * Revision 2.3  91/02/05  17:24:26  mrt
   33  *      Changed to new Mach copyright
   34  *      [91/02/01  15:52:42  mrt]
   35  * 
   36  * Revision 2.2  90/06/02  14:52:10  rpd
   37  *      Created for new IPC.
   38  *      [90/03/26  21:05:03  rpd]
   39  * 
   40  */
   41 /*
   42  *      File:   ipc/ipc_thread.h
   43  *      Author: Rich Draves
   44  *      Date:   1989
   45  *
   46  *      Definitions for the IPC component of threads.
   47  */
   48 
   49 #ifndef _IPC_IPC_THREAD_H_
   50 #define _IPC_IPC_THREAD_H_
   51 
   52 #include <kern/thread.h>
   53 
   54 typedef thread_t ipc_thread_t;
   55 
   56 #define ITH_NULL                THREAD_NULL
   57 
   58 #define ith_lock_init(thread)   simple_lock_init(&(thread)->ith_lock_data)
   59 #define ith_lock(thread)        simple_lock(&(thread)->ith_lock_data)
   60 #define ith_unlock(thread)      simple_unlock(&(thread)->ith_lock_data)
   61 
   62 typedef struct ipc_thread_queue {
   63         ipc_thread_t ithq_base;
   64 } *ipc_thread_queue_t;
   65 
   66 #define ITHQ_NULL               ((ipc_thread_queue_t) 0)
   67 
   68 
   69 #define ipc_thread_links_init(thread)           \
   70 MACRO_BEGIN                                     \
   71         (thread)->ith_next = (thread);          \
   72         (thread)->ith_prev = (thread);          \
   73 MACRO_END
   74 
   75 #define ipc_thread_queue_init(queue)            \
   76 MACRO_BEGIN                                     \
   77         (queue)->ithq_base = ITH_NULL;          \
   78 MACRO_END
   79 
   80 #define ipc_thread_queue_empty(queue)   ((queue)->ithq_base == ITH_NULL)
   81 
   82 #define ipc_thread_queue_first(queue)   ((queue)->ithq_base)
   83 
   84 #define ipc_thread_rmqueue_first_macro(queue, thread)                   \
   85 MACRO_BEGIN                                                             \
   86         register ipc_thread_t _next;                                    \
   87                                                                         \
   88         assert((queue)->ithq_base == (thread));                         \
   89                                                                         \
   90         _next = (thread)->ith_next;                                     \
   91         if (_next == (thread)) {                                        \
   92                 assert((thread)->ith_prev == (thread));                 \
   93                 (queue)->ithq_base = ITH_NULL;                          \
   94         } else {                                                        \
   95                 register ipc_thread_t _prev = (thread)->ith_prev;       \
   96                                                                         \
   97                 (queue)->ithq_base = _next;                             \
   98                 _next->ith_prev = _prev;                                \
   99                 _prev->ith_next = _next;                                \
  100                 ipc_thread_links_init(thread);                          \
  101         }                                                               \
  102 MACRO_END
  103 
  104 #define ipc_thread_enqueue_macro(queue, thread)                         \
  105 MACRO_BEGIN                                                             \
  106         register ipc_thread_t _first = (queue)->ithq_base;              \
  107                                                                         \
  108         if (_first == ITH_NULL) {                                       \
  109                 (queue)->ithq_base = (thread);                          \
  110                 assert((thread)->ith_next == (thread));                 \
  111                 assert((thread)->ith_prev == (thread));                 \
  112         } else {                                                        \
  113                 register ipc_thread_t _last = _first->ith_prev;         \
  114                                                                         \
  115                 (thread)->ith_next = _first;                            \
  116                 (thread)->ith_prev = _last;                             \
  117                 _first->ith_prev = (thread);                            \
  118                 _last->ith_next = (thread);                             \
  119         }                                                               \
  120 MACRO_END
  121 
  122 extern void
  123 ipc_thread_enqueue(/* ipc_thread_queue_t, ipc_thread_t */);
  124 
  125 extern ipc_thread_t
  126 ipc_thread_dequeue(/* ipc_thread_queue_t */);
  127 
  128 extern void
  129 ipc_thread_rmqueue(/* ipc_thread_queue_t, ipc_thread_t */);
  130 
  131 #endif  _IPC_IPC_THREAD_H_

Cache object: 74ecac34525c40d9dcbdff426f43f5d9


[ 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.