source: rtems/cpukit/include/rtems/posix/pthreadimpl.h @ 0f5b2c09

Last change on this file since 0f5b2c09 was 033f31c8, checked in by Sebastian Huber <sebastian.huber@…>, on Oct 25, 2018 at 8:26:40 AM

posix: Hide POSIX_API_Control by default

Update #2514.

  • Property mode set to 100644
File size: 3.2 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
51#if defined(RTEMS_POSIX_API)
52RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
53  Thread_Control    *the_thread,
54  POSIX_API_Control *api
55)
56{
57  the_thread->cpu_time_budget =
58    _Timespec_To_ticks( &api->Sporadic.sched_ss_init_budget );
59
60  _Watchdog_Per_CPU_insert_ticks(
61    &api->Sporadic.Timer,
62    _Per_CPU_Get(),
63    _Timespec_To_ticks( &api->Sporadic.sched_ss_repl_period )
64  );
65}
66#endif
67
68void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog );
69
70/**
71 * @brief POSIX threads sporadic budget callout.
72 *
73 * This routine handles the sporadic scheduling algorithm.
74 *
75 * @param[in] the_thread is a pointer to the thread whose budget
76 * has been exceeded.
77 */
78void _POSIX_Threads_Sporadic_budget_callout(
79  Thread_Control *the_thread
80);
81
82int _POSIX_Thread_Translate_to_sched_policy(
83  Thread_CPU_budget_algorithms budget_algorithm
84);
85
86/**
87 * @brief Translate sched_param into SuperCore terms.
88 *
89 * This method translates the POSIX API sched_param into the corresponding
90 * SuperCore settings.
91 *
92 * @param[in] policy is the POSIX scheduling policy
93 * @param[in] param points to the scheduling parameter structure
94 * @param[in] budget_algorithm points to the output CPU Budget algorithm
95 * @param[in] budget_callout points to the output CPU Callout
96 *
97 * @retval 0 Indicates success.
98 * @retval error_code POSIX error code indicating failure.
99 */
100int _POSIX_Thread_Translate_sched_param(
101  int                                  policy,
102  const struct sched_param            *param,
103  Thread_CPU_budget_algorithms        *budget_algorithm,
104  Thread_CPU_budget_algorithm_callout *budget_callout
105);
106
107RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void)
108{
109  _Objects_Allocator_lock();
110
111  _Thread_Kill_zombies();
112
113  return (Thread_Control *)
114    _Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects );
115}
116
117RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
118  Thread_Control *the_pthread
119)
120{
121  _Objects_Free( &_POSIX_Threads_Information.Objects, &the_pthread->Object );
122}
123
124/** @} */
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif
131/*  end of include file */
Note: See TracBrowser for help on using the repository browser.