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/kern/sched_prim.h

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-1987 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:        sched_prim.h,v $
   29  * Revision 2.11  93/11/17  17:24:08  dbg
   30  *      Added thread_block_noreturn to show when thread_block will
   31  *      definitely not return.  Moved stack function prototypes to
   32  *      kern/stack.h.
   33  *      [93/10/21            dbg]
   34  * 
   35  *      Added CONTINUE_NULL.
   36  *      [93/06/03            dbg]
   37  * 
   38  *      Use 'no_return' (from kern/kern_types.h) for the type of
   39  *      a function that does not return.
   40  *      [93/05/04            dbg]
   41  * 
   42  * Revision 2.10  93/03/09  10:55:24  danner
   43  *      A small GNUism to signify thread_syscall_return does not return.
   44  *      [93/03/06            af]
   45  * 
   46  * Revision 2.9  93/01/14  17:36:24  danner
   47  *      Added function prototypes.
   48  *      [92/11/11            dbg]
   49  * 
   50  * Revision 2.8  92/01/03  20:14:49  dbg
   51  *      Removed THREAD_SHOULD_TERMINATE (again).
   52  *      [91/12/19            dbg]
   53  * 
   54  * Revision 2.7  91/05/18  14:33:14  rpd
   55  *      Added recompute_priorities.
   56  *      [91/03/31            rpd]
   57  * 
   58  * Revision 2.6  91/05/14  16:46:40  mrt
   59  *      Correcting copyright
   60  * 
   61  * Revision 2.5  91/03/16  14:51:26  rpd
   62  *      Added declarations of new functions.
   63  *      [91/02/24            rpd]
   64  * 
   65  * Revision 2.4  91/02/05  17:29:09  mrt
   66  *      Changed to new Mach copyright
   67  *      [91/02/01  16:17:24  mrt]
   68  * 
   69  * Revision 2.3  90/06/02  14:56:03  rpd
   70  *      Updated to new scheduling technology.
   71  *      [90/03/26  22:17:10  rpd]
   72  * 
   73  * Revision 2.2  90/01/11  11:44:04  dbg
   74  *      Export thread_bind.
   75  *      [89/12/06            dbg]
   76  * 
   77  * Revision 2.1  89/08/03  15:53:39  rwd
   78  * Created.
   79  * 
   80  * 29-Jun-88  David Golub (dbg) at Carnegie-Mellon University
   81  *      Removed THREAD_SHOULD_TERMINATE.
   82  *
   83  * 16-May-88  Michael Young (mwyoung) at Carnegie-Mellon University
   84  *      Added thread_wakeup_with_result routine; thread_wakeup
   85  *      is a special case.
   86  *
   87  * 16-Apr-88  Michael Young (mwyoung) at Carnegie-Mellon University
   88  *      Added THREAD_RESTART wait result value.
   89  *
   90  * 29-Feb-88  David Black (dlb) at Carnegie-Mellon University
   91  *      thread_setrun is now a real routine.
   92  *
   93  * 13-Oct-87  David Golub (dbg) at Carnegie-Mellon University
   94  *      Moved thread_will_wait and thread_go to sched_prim_macros.h,
   95  *      to avoid including thread.h everywhere.
   96  *
   97  *  5-Oct-87  David Golub (dbg) at Carnegie-Mellon University
   98  *      Created.  Moved thread_will_wait and thread_go here from
   99  *      mach_ipc.
  100  */
  101 /*
  102  *      File:   sched_prim.h
  103  *      Author: David Golub
  104  *
  105  *      Scheduling primitive definitions file
  106  *
  107  */
  108 
  109 #ifndef _KERN_SCHED_PRIM_H_
  110 #define _KERN_SCHED_PRIM_H_
  111 
  112 #include <mach/boolean.h>
  113 #include <mach/message.h>       /* for mach_msg_timeout_t */
  114 #include <kern/lock.h>
  115 #include <kern/kern_types.h>    /* for thread_t */
  116 
  117 /*
  118  *      Possible results of assert_wait - returned in
  119  *      current_thread()->wait_result.
  120  */
  121 #define THREAD_AWAKENED         0               /* normal wakeup */
  122 #define THREAD_TIMED_OUT        1               /* timeout expired */
  123 #define THREAD_INTERRUPTED      2               /* interrupted by clear_wait */
  124 #define THREAD_RESTART          3               /* restart operation entirely */
  125 
  126 typedef void            *event_t;               /* wait event */
  127 
  128 typedef no_return       (*continuation_t)(void); /* continuation */
  129 
  130 #define CONTINUE_NULL   ((continuation_t) 0)
  131 
  132 /*
  133  *      Exported interface to sched_prim.c.
  134  */
  135 
  136 extern void     sched_init(void);
  137 
  138 extern void     assert_wait(
  139         event_t         event,
  140         boolean_t       interruptible);
  141 extern void     clear_wait(
  142         thread_t        thread,
  143         int             result,
  144         boolean_t       interrupt_only);
  145 extern void     thread_sleep(
  146         event_t         event,
  147         simple_lock_t   lock,
  148         boolean_t       interruptible);
  149 extern void     thread_wakeup_prim(
  150         event_t         event,
  151         boolean_t       one_thread,
  152         int             result);
  153 extern boolean_t thread_invoke(
  154         thread_t        old_thread,
  155         continuation_t  continuation,
  156         thread_t        new_thread);
  157 extern void     thread_block(
  158         continuation_t  continuation);
  159 extern void     thread_run(
  160         continuation_t  continuation,
  161         thread_t        new_thread);
  162 extern void     thread_set_timeout(
  163         int             t);
  164 extern void     thread_setrun(
  165         thread_t        thread,
  166         boolean_t       may_preempt);
  167 extern void     thread_dispatch(
  168         thread_t        thread);
  169 extern no_return thread_continue(
  170         thread_t        old_thread);
  171 extern void     thread_go(
  172         thread_t        thread);
  173 extern void     thread_will_wait(
  174         thread_t        thread);
  175 extern void     thread_will_wait_with_timeout(
  176         thread_t        thread,
  177         mach_msg_timeout_t msecs);
  178 extern boolean_t thread_handoff(
  179         thread_t        old_thread,
  180         continuation_t  continuation,
  181         thread_t        new_thread);
  182 
  183 /*
  184  *      Routines defined as macros
  185  */
  186 
  187 #define thread_wakeup(x)                                                \
  188                 thread_wakeup_prim((x), FALSE, THREAD_AWAKENED)
  189 #define thread_wakeup_with_result(x, z)                                 \
  190                 thread_wakeup_prim((x), FALSE, (z))
  191 #define thread_wakeup_one(x)                                            \
  192                 thread_wakeup_prim((x), TRUE, THREAD_AWAKENED)
  193 
  194 #define thread_block_noreturn(c) \
  195         ((*(no_return (*)(continuation_t))thread_block)((c)))
  196 
  197 #define thread_run_noreturn(c,t) \
  198         ((*(no_return (*)(continuation_t, thread_t))thread_run) ((c),(t)) )
  199 
  200 /*
  201  *      Machine-dependent code must define these functions.
  202  */
  203 
  204 extern no_return        thread_bootstrap_return(void);
  205 extern no_return        thread_exception_return(void);
  206 extern no_return        thread_syscall_return(kern_return_t);
  207 
  208 extern no_return        call_continuation(continuation_t);
  209 
  210 extern thread_t switch_context(
  211         thread_t        old_thread,
  212         continuation_t  continuation,
  213         thread_t        new_thread);
  214 extern void     stack_handoff(
  215         thread_t        old_thread,
  216         thread_t        new_thread);
  217 
  218 
  219 #endif  /* _KERN_SCHED_PRIM_H_ */

Cache object: 36fd0eee55d81b33588065a6aa5e9b33


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