RTEMS CPU Kit with SuperCore  4.11.3
pthreadimpl.h
Go to the documentation of this file.
1 
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.org/license/LICENSE.
17  */
18 
19 #ifndef _RTEMS_POSIX_PTHREADIMPL_H
20 #define _RTEMS_POSIX_PTHREADIMPL_H
21 
22 #include <rtems/posix/pthread.h>
23 #include <rtems/posix/config.h>
24 #include <rtems/posix/threadsup.h>
25 #include <rtems/score/objectimpl.h>
26 #include <rtems/score/threadimpl.h>
27 #include <rtems/score/assert.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
41 #define PTHREAD_MINIMUM_STACK_SIZE (_Stack_Minimum() * 2)
42 
48 
52 extern pthread_attr_t _POSIX_Threads_Default_attributes;
53 
61 extern void (*_POSIX_Threads_Initialize_user_threads_p)(void);
62 
69 
83  pthread_attr_t *dst_attr,
84  const pthread_attr_t *src_attr
85 );
86 
96  Thread_Control *the_pthread
97 );
98 
105  pthread_attr_t *attr
106 );
107 
117  Thread_Control *the_thread
118 );
119 
134  Objects_Id id,
135  void *argument
136 );
137 
153  int policy,
154  struct sched_param *param,
155  Thread_CPU_budget_algorithms *budget_algorithm,
157 );
158 
159 /*
160  * rtems_pthread_attribute_compare
161  */
162 int rtems_pthread_attribute_compare(
163  const pthread_attr_t *attr1,
164  const pthread_attr_t *attr2
165 );
166 
167 RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void)
168 {
170 
172 
173  return (Thread_Control *)
174  _Objects_Allocate_unprotected( &_POSIX_Threads_Information );
175 }
176 
177 /*
178  * _POSIX_Threads_Copy_attributes
179  */
180 
182  pthread_attr_t *dst_attr,
183  const pthread_attr_t *src_attr
184 )
185 {
186  *dst_attr = *src_attr;
187 #if defined(RTEMS_SMP) && defined(__RTEMS_HAVE_SYS_CPUSET_H__)
188  _Assert(
189  dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
190  );
191  dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
192 #endif
193 }
194 
195 /*
196  * _POSIX_Threads_Free
197  */
198 
200  Thread_Control *the_pthread
201 )
202 {
203  _Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
204 }
205 
206 /*
207  * _POSIX_Threads_Initialize_attributes
208  */
209 
211  pthread_attr_t *attr
212 )
213 {
215  attr,
216  &_POSIX_Threads_Default_attributes
217  );
218 }
219 
220 /*
221  * _POSIX_Threads_Is_null
222  */
223 
224 RTEMS_INLINE_ROUTINE bool _POSIX_Threads_Is_null (
225  Thread_Control *the_pthread
226 )
227 {
228  return !the_pthread;
229 }
230 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #endif
238 /* end of include file */
void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectfree.c:25
Objects_Control * _Objects_Allocate_unprotected(Objects_Information *information)
Allocates an object without locking the allocator mutex.
Definition: objectallocate.c:39
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free(Thread_Control *the_pthread)
Free POSIX control block.
Definition: pthreadimpl.h:199
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(pthread_attr_t *attr)
POSIX threads initialize user threads body.
Definition: pthreadimpl.h:210
POSIX Threads Private Support.
POSIX Thread API Support.
pthread_attr_t _POSIX_Threads_Default_attributes
This variable contains the default POSIX Thread attributes.
Definition: pthread.c:53
void _POSIX_Threads_Sporadic_budget_TSR(Objects_Id id, void *argument)
This routine supports the sporadic scheduling algorithm.
Definition: pthread.c:106
User Defined Configuration Parameters Specific For The POSIX API.
void(* Thread_CPU_budget_algorithm_callout)(Thread_Control *)
This defines thes the entry point for the thread specific timeslice budget management algorithm...
Definition: thread.h:173
Objects_Control Object
This field is the object management structure for each thread.
Definition: thread.h:673
This structure defines the Thread Control Block (TCB).
Definition: thread.h:671
void(* _POSIX_Threads_Initialize_user_threads_p)(void)
When the user configures a set of POSIX API initialization threads, This variable will point to the m...
void _POSIX_Threads_Manager_initialization(void)
POSIX threads manager initialization.
Definition: pthread.c:356
The following defines the structure for the information used to manage each class of objects...
Definition: objectimpl.h:136
void _POSIX_Threads_Sporadic_budget_callout(Thread_Control *the_thread)
POSIX threads sporadic budget callout.
Definition: pthread.c:160
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:83
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
Definition: threadrestart.c:149
int _POSIX_Thread_Translate_sched_param(int policy, struct sched_param *param, Thread_CPU_budget_algorithms *budget_algorithm, Thread_CPU_budget_algorithm_callout *budget_callout)
Translate sched_param into SuperCore terms.
Definition: psxtransschedparam.c:29
POSIX_EXTERN Objects_Information _POSIX_Threads_Information
The following defines the information control block used to manage this class of objects.
Definition: pthreadimpl.h:47
RTEMS_INLINE_ROUTINE void _Objects_Allocator_lock(void)
Locks the object allocator mutex.
Definition: objectimpl.h:1007
Inlined Routines from the Thread Handler.
Inlined Routines in the Object Handler.
uint32_t Objects_Id
The following type defines the control block used to manage object IDs.
Definition: object.h:122
#define POSIX_EXTERN
The following ensures that all data is declared in the space of the initialization routine for either...
Definition: basedefs.h:123
Thread_CPU_budget_algorithms
The following lists the algorithms used to manage the thread cpu budget.
Definition: thread.h:159
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(pthread_attr_t *dst_attr, const pthread_attr_t *src_attr)
Copy POSIX Thread attribute structure.
Definition: pthreadimpl.h:181