RTEMS 6.1-rc1
pthreadimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 1989-2011.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_POSIX_PTHREADIMPL_H
39#define _RTEMS_POSIX_PTHREADIMPL_H
40
41#include <rtems/posix/pthread.h>
43#include <rtems/score/assert.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
61#define PTHREAD_MINIMUM_STACK_SIZE _POSIX_Threads_Minimum_stack_size
62
63#if defined(RTEMS_POSIX_API)
64static inline void _POSIX_Threads_Sporadic_timer_insert(
65 Thread_Control *the_thread,
66 POSIX_API_Control *api
67)
68{
69 the_thread->CPU_budget.available =
70 _Timespec_To_ticks( &api->Sporadic.sched_ss_init_budget );
71
72 _Watchdog_Per_CPU_insert_ticks(
73 &api->Sporadic.Timer,
74 _Per_CPU_Get(),
75 _Timespec_To_ticks( &api->Sporadic.sched_ss_repl_period )
76 );
77}
78#endif
79
80void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog );
81
86
87int _POSIX_Thread_Translate_to_sched_policy(
88 const Thread_CPU_budget_operations *operations
89);
90
107 int policy,
108 const struct sched_param *param,
110);
111
112static inline Thread_Control *_POSIX_Threads_Allocate(void)
113{
114 _Objects_Allocator_lock();
115
117
118 return (Thread_Control *)
119 _Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects );
120}
121
124#ifdef __cplusplus
125}
126#endif
127
128#endif
129/* end of include file */
This header file provides the interfaces of the Assert Handler.
Thread_Information _POSIX_Threads_Information
int _POSIX_Thread_Translate_sched_param(int policy, const struct sched_param *param, Thread_Configuration *config)
Translates the POSIX scheduling policy and parameters to parts of the thread configuration.
Definition: psxtransschedparam.c:68
const Thread_CPU_budget_operations _POSIX_Threads_Sporadic_budget
The POSIX threads sporadic budget operations.
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
Definition: threadrestart.c:167
uint32_t _Timespec_To_ticks(const struct timespec *time)
Converts timespec to number of ticks.
Definition: timespectoticks.c:51
POSIX Threads Private Support.
This header file provides interfaces of the Object Handler which are only used by the implementation.
This header file provides the interfaces of the Timespec Helpers.
uint32_t available
This member contains the count of the time quantum that this thread is allowed to consume until an ac...
Definition: thread.h:201
This structure contains operations which manage the CPU budget of a thread.
Definition: thread.h:165
The configuration of a new thread to initialize.
Definition: threadimpl.h:169
Objects_Information Objects
The object information.
Definition: thread.h:1102
The control block used to manage each watchdog timer.
Definition: watchdog.h:109
Definition: thread.h:812
Thread_CPU_budget_control CPU_budget
This member contains the CPU budget control used to manage the CPU budget of the thread.
Definition: thread.h:903
Definition: deflate.c:114
This header file provides interfaces of the Thread Handler which are only used by the implementation.
POSIX Thread API Support.
This header file provides interfaces of the Watchdog Handler which are only used by the implementatio...