diff options
Diffstat (limited to 'cpukit/include/rtems/score/threaddispatch.h')
-rw-r--r-- | cpukit/include/rtems/score/threaddispatch.h | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/cpukit/include/rtems/score/threaddispatch.h b/cpukit/include/rtems/score/threaddispatch.h index 7f3673a0d5..b06ebe8fec 100644 --- a/cpukit/include/rtems/score/threaddispatch.h +++ b/cpukit/include/rtems/score/threaddispatch.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -11,9 +13,26 @@ * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RTEMS_SCORE_THREADDISPATCH_H @@ -53,7 +72,7 @@ extern "C" { * @retval false The executing thread is inside a thread dispatch critical * section and dispatching is not allowed. */ -RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled(void) +static inline bool _Thread_Dispatch_is_enabled(void) { bool enabled; @@ -77,7 +96,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled(void) * * @return The value of the thread dispatch level. */ -RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void) +static inline uint32_t _Thread_Dispatch_get_disable_level(void) { return _Thread_Dispatch_disable_level; } @@ -87,7 +106,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void) * * This routine initializes the thread dispatching subsystem. */ -RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void ) +static inline void _Thread_Dispatch_initialization( void ) { _Thread_Dispatch_disable_level = 1; } @@ -161,7 +180,7 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level ); * * @return The current processor. */ -RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable_with_CPU( +static inline Per_CPU_Control *_Thread_Dispatch_disable_with_CPU( Per_CPU_Control *cpu_self, const ISR_lock_Context *lock_context ) @@ -188,7 +207,7 @@ RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable_with_CPU( * * @return The current processor. */ -RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable_critical( +static inline Per_CPU_Control *_Thread_Dispatch_disable_critical( const ISR_lock_Context *lock_context ) { @@ -200,19 +219,20 @@ RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable_critical( * * @return The current processor. */ -RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable( void ) +static inline Per_CPU_Control *_Thread_Dispatch_disable( void ) { Per_CPU_Control *cpu_self; - ISR_lock_Context lock_context; #if defined( RTEMS_SMP ) || defined( RTEMS_PROFILING ) + ISR_lock_Context lock_context; + _ISR_lock_ISR_disable( &lock_context ); -#endif cpu_self = _Thread_Dispatch_disable_critical( &lock_context ); -#if defined( RTEMS_SMP ) || defined( RTEMS_PROFILING ) _ISR_lock_ISR_enable( &lock_context ); +#else + cpu_self = _Thread_Dispatch_disable_critical( NULL ); #endif return cpu_self; @@ -232,7 +252,7 @@ void _Thread_Dispatch_enable( Per_CPU_Control *cpu_self ); * * @param[in, out] cpu_self The current processor. */ -RTEMS_INLINE_ROUTINE void _Thread_Dispatch_unnest( Per_CPU_Control *cpu_self ) +static inline void _Thread_Dispatch_unnest( Per_CPU_Control *cpu_self ) { _Assert( cpu_self->thread_dispatch_disable_level > 0 ); --cpu_self->thread_dispatch_disable_level; @@ -244,7 +264,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_unnest( Per_CPU_Control *cpu_self ) * @param[in, out] cpu_self The current processor. * @param[in, out] cpu_target The target processor to request a thread dispatch. */ -RTEMS_INLINE_ROUTINE void _Thread_Dispatch_request( +static inline void _Thread_Dispatch_request( Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_target ) |