source: rtems/cpukit/posix/include/rtems/posix/pthread.h @ cf301c9

4.115
Last change on this file since cf301c9 was cf301c9, checked in by Alex Ivanov <alexivanov97@…>, on 01/07/13 at 14:53:43

posix: Doxygen Clean Up Task #1

  • Property mode set to 100644
File size: 5.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Threads Private Support
5 *
6 * This include file contains all the private support information for
7 * POSIX threads.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_POSIX_PTHREAD_H
20#define _RTEMS_POSIX_PTHREAD_H
21
22
23#include <rtems/posix/config.h>
24#include <rtems/posix/threadsup.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @defgroup POSIX_PTHREAD POSIX Threads Support
32 *
33 * @ingroup POSIX
34 *
35 * @brief Private Support Information for POSIX Threads
36 *
37 * @{
38 */
39
40/**
41 * The following sets the minimum stack size for POSIX threads.
42 */
43#define PTHREAD_MINIMUM_STACK_SIZE (_Stack_Minimum() * 2)
44
45/**
46 * The following defines the information control block used to manage
47 * this class of objects.
48 */
49POSIX_EXTERN Objects_Information  _POSIX_Threads_Information;
50
51/**
52 * This variable contains the default POSIX Thread attributes.
53 */
54extern const pthread_attr_t _POSIX_Threads_Default_attributes;
55
56/**
57 * When the user configures a set of POSIX API initialization threads,
58 * This variable will point to the method used to initialize them.
59 *
60 * NOTE: It is instantiated and initialized by confdefs.h based upon
61 *       application requirements.
62 */
63extern void (*_POSIX_Threads_Initialize_user_threads_p)(void);
64
65/**
66 * @brief POSIX threads manager initialization.
67 *
68 * This routine performs the initialization necessary for this manager.
69 */
70void _POSIX_Threads_Manager_initialization(void);
71
72/**
73 * @brief Allocate POSIX thread control block.
74 *
75 * This function allocates a pthread control block from
76 * the inactive chain of free pthread control blocks.
77 *
78 * @return This method returns a newly allocated thread.
79 */
80RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void );
81
82/**
83 * @brief Free POSIX control block.
84 *
85 * This routine frees a pthread control block to the
86 * inactive chain of free pthread control blocks.
87 *
88 * @param[in] the_pthread is a pointer to the thread to free.
89 */
90RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free(
91  Thread_Control *the_pthread
92);
93
94/**
95 * @brief Map POSIX thread IDs to control blocks.
96 *
97 * This function maps pthread IDs to pthread control blocks.
98 * If ID corresponds to a local pthread, then it returns
99 * the_pthread control pointer which maps to ID and location
100 * is set to OBJECTS_LOCAL.  if the pthread ID is global and
101 * resides on a remote node, then location is set to OBJECTS_REMOTE,
102 * and the_pthread is undefined.  Otherwise, location is set
103 * to OBJECTS_ERROR and the_pthread is undefined.
104 *
105 * @param[in] id is the id to lookup
106 * @param[in] location points to the returned location value
107 *
108 * @return This methods returns a pointer to the corresponding Thread_Control.
109 */
110RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get(
111  pthread_t          id,
112  Objects_Locations *location
113);
114
115/**
116 * @brief Check if a POSIX thread control block is NULL.
117 *
118 * This function returns @c TRUE if the_pthread is @c NULL and @c FALSE
119 * otherwise.
120 *
121 * @param[in] the_pthread is a pointer to the POSIX thread control block
122 * to check.
123 *
124 * @retval TRUE The thread control block is @c NULL.
125 * @retval FALSE The thread control block is not @c NULL.
126 */
127RTEMS_INLINE_ROUTINE bool _POSIX_Threads_Is_null(
128  Thread_Control *the_pthread
129);
130
131/**
132 * @brief POSIX threads sporadic budget callout.
133 *
134 * This routine handles the sporadic scheduling algorithm.
135 *
136 * @param[in] the_thread is a pointer to the thread whose budget
137 * has been exceeded.
138 */
139void _POSIX_Threads_Sporadic_budget_callout(
140  Thread_Control *the_thread
141);
142
143/**
144 * This routine supports the sporadic scheduling algorithm.  It
145 * is scheduled to be executed at the end of each replenishment
146 * period.  In sporadic scheduling a thread will execute at a
147 * high priority for a user specified amount of CPU time.  When
148 * it exceeds that amount of CPU time, its priority is automatically
149 * lowered. This TSR is executed when it is time to replenish
150 * the thread's processor budget and raise its priority.
151 *
152 * @param[in] id is ignored
153 * @param[in] argument is a pointer to the Thread_Control structure
154 *            for the thread being replenished.
155 */
156void _POSIX_Threads_Sporadic_budget_TSR(
157  Objects_Id      id,
158  void           *argument
159);
160
161/**
162 * @brief Translate sched_param into SuperCore terms.
163 *
164 * This method translates the POSIX API sched_param into the corresponding
165 * SuperCore settings.
166 *
167 * @param[in] policy is the POSIX scheduling policy
168 * @param[in] param points to the scheduling parameter structure
169 * @param[in] budget_algorithm points to the output CPU Budget algorithm
170 * @param[in] budget_callout points to the output CPU Callout
171 *
172 * @retval 0 Indicates success.
173 * @retval error_code POSIX error code indicating failure.
174 */
175int _POSIX_Thread_Translate_sched_param(
176  int                                  policy,
177  struct sched_param                  *param,
178  Thread_CPU_budget_algorithms        *budget_algorithm,
179  Thread_CPU_budget_algorithm_callout *budget_callout
180);
181
182/**
183 * @brief POSIX threads initialize user threads body.
184 *
185 * This routine creates and starts all configured user
186 * initialization threads.
187 */
188extern void _POSIX_Threads_Initialize_user_threads_body(void);
189
190#include <rtems/posix/pthread.inl>
191
192/** @} */
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif
199/*  end of include file */
Note: See TracBrowser for help on using the repository browser.