![]() |
|
|||
File indexing completed on 2025-05-11 08:24:12
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @brief POSIX Threads Private Support 0007 * 0008 * This include file contains all the private support information for 0009 * POSIX threads. 0010 */ 0011 0012 /* 0013 * COPYRIGHT (c) 1989-2011. 0014 * On-Line Applications Research Corporation (OAR). 0015 * 0016 * Redistribution and use in source and binary forms, with or without 0017 * modification, are permitted provided that the following conditions 0018 * are met: 0019 * 1. Redistributions of source code must retain the above copyright 0020 * notice, this list of conditions and the following disclaimer. 0021 * 2. Redistributions in binary form must reproduce the above copyright 0022 * notice, this list of conditions and the following disclaimer in the 0023 * documentation and/or other materials provided with the distribution. 0024 * 0025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0028 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0029 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0030 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0031 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0032 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0033 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0034 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0035 * POSSIBILITY OF SUCH DAMAGE. 0036 */ 0037 0038 #ifndef _RTEMS_POSIX_PTHREADIMPL_H 0039 #define _RTEMS_POSIX_PTHREADIMPL_H 0040 0041 #include <rtems/posix/pthread.h> 0042 #include <rtems/posix/threadsup.h> 0043 #include <rtems/score/assert.h> 0044 #include <rtems/score/objectimpl.h> 0045 #include <rtems/score/timespec.h> 0046 #include <rtems/score/threadimpl.h> 0047 #include <rtems/score/watchdogimpl.h> 0048 0049 #ifdef __cplusplus 0050 extern "C" { 0051 #endif 0052 0053 /** 0054 * @addtogroup POSIX_PTHREAD 0055 */ 0056 /**@{**/ 0057 0058 /** 0059 * The following sets the minimum stack size for POSIX threads. 0060 */ 0061 #define PTHREAD_MINIMUM_STACK_SIZE _POSIX_Threads_Minimum_stack_size 0062 0063 #if defined(RTEMS_POSIX_API) 0064 static inline void _POSIX_Threads_Sporadic_timer_insert( 0065 Thread_Control *the_thread, 0066 POSIX_API_Control *api 0067 ) 0068 { 0069 the_thread->CPU_budget.available = 0070 _Timespec_To_ticks( &api->Sporadic.sched_ss_init_budget ); 0071 0072 _Watchdog_Per_CPU_insert_ticks( 0073 &api->Sporadic.Timer, 0074 _Per_CPU_Get(), 0075 _Timespec_To_ticks( &api->Sporadic.sched_ss_repl_period ) 0076 ); 0077 } 0078 #endif 0079 0080 void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog ); 0081 0082 /** 0083 * @brief The POSIX threads sporadic budget operations. 0084 */ 0085 extern const Thread_CPU_budget_operations _POSIX_Threads_Sporadic_budget; 0086 0087 int _POSIX_Thread_Translate_to_sched_policy( 0088 const Thread_CPU_budget_operations *operations 0089 ); 0090 0091 /** 0092 * @brief Translates the POSIX scheduling policy and parameters to parts of the 0093 * thread configuration. 0094 * 0095 * @param policy is the POSIX scheduling policy. 0096 * 0097 * @param param is the pointer to the POSIX scheduling parameters. 0098 * 0099 * @param[out] config is the pointer to a thread configuration to set the 0100 * budget algorithm, callout, and CPU time budget. 0101 * 0102 * @retval 0 The operation was successful. 0103 * 0104 * @retval EINVAL The POSIX scheduling policy or parameters were invalid. 0105 */ 0106 int _POSIX_Thread_Translate_sched_param( 0107 int policy, 0108 const struct sched_param *param, 0109 Thread_Configuration *config 0110 ); 0111 0112 static inline Thread_Control *_POSIX_Threads_Allocate(void) 0113 { 0114 _Objects_Allocator_lock(); 0115 0116 _Thread_Kill_zombies(); 0117 0118 return (Thread_Control *) 0119 _Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects ); 0120 } 0121 0122 /** @} */ 0123 0124 #ifdef __cplusplus 0125 } 0126 #endif 0127 0128 #endif 0129 /* end of include file */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |