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

5
Last change on this file since fe7aefd5 was fd27bae, checked in by Sebastian Huber <sebastian.huber@…>, on 08/07/18 at 04:25:47

CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE

Make CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE configurable by the user.

Update #3434.

  • Property mode set to 100644
File size: 3.1 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/assert.h>
26#include <rtems/score/objectimpl.h>
27#include <rtems/score/timespec.h>
28#include <rtems/score/threadimpl.h>
29#include <rtems/score/watchdogimpl.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/**
36 * @addtogroup POSIX_PTHREAD
37 */
38/**@{**/
39
40/**
41 * The following sets the minimum stack size for POSIX threads.
42 */
43#define PTHREAD_MINIMUM_STACK_SIZE _Configuration_POSIX_Minimum_stack_size
44
45/**
46 * The following defines the information control block used to manage
47 * this class of objects.
48 */
49extern Thread_Information _POSIX_Threads_Information;
50
51RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
52  Thread_Control    *the_thread,
53  POSIX_API_Control *api
54)
55{
56  the_thread->cpu_time_budget =
57    _Timespec_To_ticks( &api->Sporadic.sched_ss_init_budget );
58
59  _Watchdog_Per_CPU_insert_ticks(
60    &api->Sporadic.Timer,
61    _Per_CPU_Get(),
62    _Timespec_To_ticks( &api->Sporadic.sched_ss_repl_period )
63  );
64}
65
66void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog );
67
68/**
69 * @brief POSIX threads sporadic budget callout.
70 *
71 * This routine handles the sporadic scheduling algorithm.
72 *
73 * @param[in] the_thread is a pointer to the thread whose budget
74 * has been exceeded.
75 */
76void _POSIX_Threads_Sporadic_budget_callout(
77  Thread_Control *the_thread
78);
79
80int _POSIX_Thread_Translate_to_sched_policy(
81  Thread_CPU_budget_algorithms budget_algorithm
82);
83
84/**
85 * @brief Translate sched_param into SuperCore terms.
86 *
87 * This method translates the POSIX API sched_param into the corresponding
88 * SuperCore settings.
89 *
90 * @param[in] policy is the POSIX scheduling policy
91 * @param[in] param points to the scheduling parameter structure
92 * @param[in] budget_algorithm points to the output CPU Budget algorithm
93 * @param[in] budget_callout points to the output CPU Callout
94 *
95 * @retval 0 Indicates success.
96 * @retval error_code POSIX error code indicating failure.
97 */
98int _POSIX_Thread_Translate_sched_param(
99  int                                  policy,
100  const struct sched_param            *param,
101  Thread_CPU_budget_algorithms        *budget_algorithm,
102  Thread_CPU_budget_algorithm_callout *budget_callout
103);
104
105RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void)
106{
107  _Objects_Allocator_lock();
108
109  _Thread_Kill_zombies();
110
111  return (Thread_Control *)
112    _Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects );
113}
114
115RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
116  Thread_Control *the_pthread
117)
118{
119  _Objects_Free( &_POSIX_Threads_Information.Objects, &the_pthread->Object );
120}
121
122/** @} */
123
124#ifdef __cplusplus
125}
126#endif
127
128#endif
129/*  end of include file */
Note: See TracBrowser for help on using the repository browser.