![]() |
|
|||
File indexing completed on 2025-05-11 08:24:13
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSScoreThreadMP 0007 * 0008 * @brief This header file provides the interfaces of the 0009 * @ref RTEMSScoreThreadMP. 0010 */ 0011 0012 /* 0013 * COPYRIGHT (c) 1989-2009. 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_SCORE_THREADMP_H 0039 #define _RTEMS_SCORE_THREADMP_H 0040 0041 #ifndef _RTEMS_SCORE_THREADIMPL_H 0042 # error "Never use <rtems/score/threadmp.h> directly; include <rtems/score/threadimpl.h> instead." 0043 #endif 0044 0045 #include <rtems/score/mpciimpl.h> 0046 0047 #ifdef __cplusplus 0048 extern "C" { 0049 #endif 0050 0051 /** 0052 * @defgroup RTEMSScoreThreadMP Thread Handler Multiprocessing (MP) Support 0053 * 0054 * @ingroup RTEMSScoreThread 0055 * 0056 * @brief This group contains the implementation to support the Thread Handler 0057 * in multiprocessing (MP) configurations. 0058 * 0059 * This handler encapsulates functionality which is related to managing 0060 * threads in a multiprocessor system configuration. This handler must 0061 * manage proxies which represent remote threads blocking on local 0062 * operations. 0063 * 0064 * @{ 0065 */ 0066 0067 /** 0068 * @brief Initialize MP thread handler. 0069 * 0070 * This routine initializes the multiprocessing portion of the Thread Handler. 0071 * 0072 * @param maximum_proxies The maximum number of proxies for the MP thread handler. 0073 */ 0074 void _Thread_MP_Handler_initialization ( 0075 uint32_t maximum_proxies 0076 ); 0077 0078 /** 0079 * @brief Allocates a MP proxy control block from 0080 * the inactive chain of free proxy control blocks. 0081 * 0082 * This allocates a proxy control block from 0083 * the inactive chain of free proxy control blocks. 0084 * 0085 * @note This function returns a thread control pointer 0086 * because proxies are substitutes for remote threads. 0087 * 0088 * * @param the_state The state for the allocated MP proxy control block. 0089 */ 0090 Thread_Control *_Thread_MP_Allocate_proxy ( 0091 States_Control the_state 0092 ); 0093 0094 /** 0095 * @brief Removes the MP proxy control block for the specified 0096 * id from the active chain of proxy control blocks. 0097 * 0098 * This function removes the proxy control block for the specified 0099 * id from the active red-black tree of proxy control blocks. 0100 * 0101 * @param the_id The id of the proxy control block to remove. 0102 * 0103 * @return The removed proxy control block. 0104 */ 0105 Thread_Control *_Thread_MP_Find_proxy ( 0106 Objects_Id the_id 0107 ); 0108 0109 /** 0110 * This function returns true if the thread in question is the 0111 * multiprocessing receive thread. 0112 * 0113 * @note This is a macro to avoid needing a prototype for 0114 * _MPCI_Receive_server_tcb until it is used. 0115 */ 0116 #define _Thread_MP_Is_receive(_the_thread) \ 0117 ((_the_thread) == _MPCI_Receive_server_tcb) 0118 0119 /** 0120 * @brief Extracts the proxy of the thread if necessary. 0121 * 0122 * This routine ensures that if there is a proxy for this thread on another 0123 * node, it is also dealt with. A proxy is a data that is on the thread queue 0124 * on the remote node and acts as a proxy for the local thread. If the local 0125 * thread was waiting on a remote operation, then the remote side of the 0126 * operation must be cleaned up. 0127 * 0128 * @param[in, out] the_thread is the thread to determine the proxy. 0129 */ 0130 void _Thread_MP_Extract_proxy( Thread_Control *the_thread ); 0131 0132 /** 0133 * @brief Trees a proxy control block to the inactive chain of free proxy 0134 * control blocks. 0135 */ 0136 void _Thread_MP_Free_proxy( Thread_Control *the_thread ); 0137 0138 /** 0139 * @brief Checks if the thread MP with this object id is remote. 0140 * 0141 * @param id The object id. 0142 * 0143 * @retval true The object id is valid and the thread MP with this object id 0144 * is remote. 0145 * @retval false The object if is not valid or the thread MP with this object 0146 * id is not remote. 0147 */ 0148 static inline bool _Thread_MP_Is_remote( Objects_Id id ) 0149 { 0150 Objects_Information *information; 0151 0152 information = _Thread_Get_objects_information_by_id( id ); 0153 if ( information == NULL ) { 0154 return false; 0155 } 0156 0157 return _Objects_MP_Is_remote( id, information ); 0158 } 0159 0160 /** @} */ 0161 0162 #ifdef __cplusplus 0163 } 0164 #endif 0165 0166 #endif 0167 /* 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 |
![]() ![]() |