sched.h
Go to the documentation of this file.
00001 /*
00002  * Module: sched.h
00003  *
00004  * Purpose:
00005  *      Provides an implementation of POSIX realtime extensions
00006  *      as defined in 
00007  *
00008  *              POSIX 1003.1b-1993      (POSIX.1b)
00009  *
00010  * --------------------------------------------------------------------------
00011  *
00012  *      Pthreads-win32 - POSIX Threads Library for Win32
00013  *      Copyright(C) 1998 John E. Bossom
00014  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
00015  * 
00016  *      Contact Email: rpj@callisto.canberra.edu.au
00017  * 
00018  *      The current list of contributors is contained
00019  *      in the file CONTRIBUTORS included with the source
00020  *      code distribution. The list can also be seen at the
00021  *      following World Wide Web location:
00022  *      http://sources.redhat.com/pthreads-win32/contributors.html
00023  * 
00024  *      This library is free software; you can redistribute it and/or
00025  *      modify it under the terms of the GNU Lesser General Public
00026  *      License as published by the Free Software Foundation; either
00027  *      version 2 of the License, or (at your option) any later version.
00028  * 
00029  *      This library is distributed in the hope that it will be useful,
00030  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00031  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00032  *      Lesser General Public License for more details.
00033  * 
00034  *      You should have received a copy of the GNU Lesser General Public
00035  *      License along with this library in the file COPYING.LIB;
00036  *      if not, write to the Free Software Foundation, Inc.,
00037  *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00038  */
00039 #ifndef _SCHED_H
00040 #define _SCHED_H
00041 
00042 #undef PTW32_LEVEL
00043 
00044 #if defined(_POSIX_SOURCE)
00045 #define PTW32_LEVEL 0
00046 /* Early POSIX */
00047 #endif
00048 
00049 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
00050 #undef PTW32_LEVEL
00051 #define PTW32_LEVEL 1
00052 /* Include 1b, 1c and 1d */
00053 #endif
00054 
00055 #if defined(INCLUDE_NP)
00056 #undef PTW32_LEVEL
00057 #define PTW32_LEVEL 2
00058 /* Include Non-Portable extensions */
00059 #endif
00060 
00061 #define PTW32_LEVEL_MAX 3
00062 
00063 #if !defined(PTW32_LEVEL)
00064 #define PTW32_LEVEL PTW32_LEVEL_MAX
00065 /* Include everything */
00066 #endif
00067 
00068 
00069 #if __GNUC__ && ! defined (__declspec)
00070 # error Please upgrade your GNU compiler to one that supports __declspec.
00071 #endif
00072 
00073 /*
00074  * When building the DLL code, you should define PTW32_BUILD so that
00075  * the variables/functions are exported correctly. When using the DLL,
00076  * do NOT define PTW32_BUILD, and then the variables/functions will
00077  * be imported correctly.
00078  */
00079 #ifndef PTW32_STATIC_LIB
00080 #  ifdef PTW32_BUILD
00081 #    define PTW32_DLLPORT __declspec (dllexport)
00082 #  else
00083 #    define PTW32_DLLPORT __declspec (dllimport)
00084 #  endif
00085 #else
00086 #  define PTW32_DLLPORT
00087 #endif
00088 
00089 /*
00090  * This is a duplicate of what is in the autoconf config.h,
00091  * which is only used when building the pthread-win32 libraries.
00092  */
00093 
00094 #ifndef PTW32_CONFIG_H
00095 #  if defined(WINCE)
00096 #    define NEED_ERRNO
00097 #    define NEED_SEM
00098 #  endif
00099 #  if defined(_UWIN) || defined(__MINGW32__)
00100 #    define HAVE_MODE_T
00101 #  endif
00102 #endif
00103 
00104 /*
00105  *
00106  */
00107 
00108 #if PTW32_LEVEL >= PTW32_LEVEL_MAX
00109 #ifdef NEED_ERRNO
00110 #include "need_errno.h"
00111 #else
00112 #include <errno.h>
00113 #endif
00114 #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
00115 
00116 #if defined(__MINGW32__) || defined(_UWIN)
00117 #if PTW32_LEVEL >= PTW32_LEVEL_MAX
00118 /* For pid_t */
00119 #  include <sys/types.h>
00120 /* Required by Unix 98 */
00121 #  include <time.h>
00122 #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
00123 #else
00124 typedef int pid_t;
00125 #endif
00126 
00127 /* Thread scheduling policies */
00128 
00129 enum {
00130   SCHED_OTHER = 0,
00131   SCHED_FIFO,
00132   SCHED_RR,
00133   SCHED_MIN   = SCHED_OTHER,
00134   SCHED_MAX   = SCHED_RR
00135 };
00136 
00137 struct sched_param {
00138   int sched_priority;
00139 };
00140 
00141 #ifdef __cplusplus
00142 extern "C"
00143 {
00144 #endif                          /* __cplusplus */
00145 
00146 PTW32_DLLPORT int __cdecl sched_yield (void);
00147 
00148 PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
00149 
00150 PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
00151 
00152 PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
00153 
00154 PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
00155 
00156 /*
00157  * Note that this macro returns ENOTSUP rather than
00158  * ENOSYS as might be expected. However, returning ENOSYS
00159  * should mean that sched_get_priority_{min,max} are
00160  * not implemented as well as sched_rr_get_interval.
00161  * This is not the case, since we just don't support
00162  * round-robin scheduling. Therefore I have chosen to
00163  * return the same value as sched_setscheduler when
00164  * SCHED_RR is passed to it.
00165  */
00166 #define sched_rr_get_interval(_pid, _interval) \
00167   ( errno = ENOTSUP, (int) -1 )
00168 
00169 
00170 #ifdef __cplusplus
00171 }                               /* End of extern "C" */
00172 #endif                          /* __cplusplus */
00173 
00174 #undef PTW32_LEVEL
00175 #undef PTW32_LEVEL_MAX
00176 
00177 #endif                          /* !_SCHED_H */
00178 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


kni
Author(s): Neuronics AG (see AUTHORS.txt); ROS wrapper by Martin Günther
autogenerated on Tue May 28 2013 14:52:54