source: rtems/cpukit/posix/include/rtems/posix/pthreadimpl.h @ d07f582

5
Last change on this file since d07f582 was d07f582, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 15, 2016 at 5:59:33 AM

posix: Remove superfluous code

Remove double declarations, useless comments and unused functions.

  • Property mode set to 100644
File size: 4.0 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.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
30extern "C" {
31#endif
32
33/**
34 * @addtogroup POSIX_PTHREAD
35 */
36/**@{**/
37
38/**
39 * The following sets the minimum stack size for POSIX threads.
40 */
41#define PTHREAD_MINIMUM_STACK_SIZE (_Stack_Minimum() * 2)
42
43/**
44 * The following defines the information control block used to manage
45 * this class of objects.
46 */
47extern Thread_Information _POSIX_Threads_Information;
48
49/**
50 * This variable contains the default POSIX Thread attributes.
51 */
52extern pthread_attr_t _POSIX_Threads_Default_attributes;
53
54/**
55 * @brief POSIX threads sporadic budget callout.
56 *
57 * This routine handles the sporadic scheduling algorithm.
58 *
59 * @param[in] the_thread is a pointer to the thread whose budget
60 * has been exceeded.
61 */
62void _POSIX_Threads_Sporadic_budget_callout(
63  Thread_Control *the_thread
64);
65
66/**
67 * This routine supports the sporadic scheduling algorithm.  It
68 * is scheduled to be executed at the end of each replenishment
69 * period.  In sporadic scheduling a thread will execute at a
70 * high priority for a user specified amount of CPU time.  When
71 * it exceeds that amount of CPU time, its priority is automatically
72 * lowered. This TSR is executed when it is time to replenish
73 * the thread's processor budget and raise its priority.
74 *
75 * @param[in] id is ignored
76 * @param[in] argument is a pointer to the Thread_Control structure
77 *            for the thread being replenished.
78 */
79void _POSIX_Threads_Sporadic_budget_TSR( Watchdog_Control *watchdog );
80
81/**
82 * @brief Translate sched_param into SuperCore terms.
83 *
84 * This method translates the POSIX API sched_param into the corresponding
85 * SuperCore settings.
86 *
87 * @param[in] policy is the POSIX scheduling policy
88 * @param[in] param points to the scheduling parameter structure
89 * @param[in] budget_algorithm points to the output CPU Budget algorithm
90 * @param[in] budget_callout points to the output CPU Callout
91 *
92 * @retval 0 Indicates success.
93 * @retval error_code POSIX error code indicating failure.
94 */
95int _POSIX_Thread_Translate_sched_param(
96  int                                  policy,
97  struct sched_param                  *param,
98  Thread_CPU_budget_algorithms        *budget_algorithm,
99  Thread_CPU_budget_algorithm_callout *budget_callout
100);
101
102/*
103 * rtems_pthread_attribute_compare
104 */
105int rtems_pthread_attribute_compare(
106  const pthread_attr_t *attr1,
107  const pthread_attr_t *attr2
108);
109
110RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void)
111{
112  _Objects_Allocator_lock();
113
114  _Thread_Kill_zombies();
115
116  return (Thread_Control *)
117    _Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects );
118}
119
120RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(
121  pthread_attr_t        *dst_attr,
122  const pthread_attr_t  *src_attr
123)
124{
125  *dst_attr = *src_attr;
126#if defined(RTEMS_SMP) && defined(__RTEMS_HAVE_SYS_CPUSET_H__)
127  _Assert(
128    dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
129  );
130  dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
131#endif
132}
133
134RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
135  Thread_Control *the_pthread
136)
137{
138  _Objects_Free( &_POSIX_Threads_Information.Objects, &the_pthread->Object );
139}
140
141RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(
142  pthread_attr_t  *attr
143)
144{
145  _POSIX_Threads_Copy_attributes(
146    attr,
147    &_POSIX_Threads_Default_attributes
148  );
149}
150
151/** @} */
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif
158/*  end of include file */
Note: See TracBrowser for help on using the repository browser.