RTEMS 6.1-rc2
Loading...
Searching...
No Matches
pthreadattrimpl.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_PTHREADATTRIMPL_H
39#define _RTEMS_POSIX_PTHREADATTRIMPL_H
40
41#include <errno.h>
42#include <pthread.h>
43
45#include <rtems/score/assert.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
61extern const pthread_attr_t _POSIX_Threads_Default_attributes;
62
63static inline void _POSIX_Threads_Copy_attributes(
64 pthread_attr_t *dst_attr,
65 const pthread_attr_t *src_attr
66)
67{
68 *dst_attr = *src_attr;
69 _Assert(
70 dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
71 );
72 dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
73}
74
75static inline void _POSIX_Threads_Initialize_attributes(
76 pthread_attr_t *attr
77)
78{
79 _POSIX_Threads_Copy_attributes(
80 attr,
82 );
83}
84
85static inline void _POSIX_Threads_Get_sched_param_sporadic(
86 const Thread_Control *the_thread,
87 const Scheduler_Control *scheduler,
88 struct sched_param *param
89)
90{
91#if defined(RTEMS_POSIX_API)
92 const POSIX_API_Control *api;
93
94 api = (const POSIX_API_Control*) the_thread->API_Extensions[ THREAD_API_POSIX ];
95 param->sched_ss_low_priority = _POSIX_Priority_From_core(
96 scheduler,
97 api->Sporadic.Low_priority.priority
98 );
99 param->sched_ss_repl_period = api->Sporadic.sched_ss_repl_period;
100 param->sched_ss_init_budget = api->Sporadic.sched_ss_init_budget;
101 param->sched_ss_max_repl = api->Sporadic.sched_ss_max_repl;
102#else
103 (void) the_thread;
104 (void) scheduler;
105 (void) param;
106#endif
107}
108
111#ifdef __cplusplus
112}
113#endif
114
115#endif
116/* end of include file */
This header file provides the interfaces of the Assert Handler.
This header file provides basic definitions used by the API and the implementation.
int _POSIX_Priority_From_core(const Scheduler_Control *scheduler, Priority_Control priority)
Converts the SuperCore priority to the corresponding POSIX API priority.
Definition: psxpriorityisvalid.c:61
const pthread_attr_t _POSIX_Threads_Default_attributes
Definition: pthreadattrdefault.c:49
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
@ THREAD_API_POSIX
Definition: thread.h:631
POSIX Priority Support.
POSIX Threads Private Support.
Scheduler control.
Definition: scheduler.h:335
Definition: thread.h:812
void * API_Extensions[THREAD_API_LAST+1]
Definition: thread.h:938
POSIX Thread API Support.