diff options
Diffstat (limited to 'cpukit/include/rtems/score/coresemimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/coresemimpl.h | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/cpukit/include/rtems/score/coresemimpl.h b/cpukit/include/rtems/score/coresemimpl.h index 00356b80bf..ca952a4570 100644 --- a/cpukit/include/rtems/score/coresemimpl.h +++ b/cpukit/include/rtems/score/coresemimpl.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -11,9 +13,26 @@ * COPYRIGHT (c) 1989-2006. * 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_CORESEMIMPL_H @@ -62,7 +81,7 @@ void _CORE_semaphore_Initialize( * @param[in, out] the_semaphore The semaphore to acquire. * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _CORE_semaphore_Acquire_critical( +static inline void _CORE_semaphore_Acquire_critical( CORE_semaphore_Control *the_semaphore, Thread_queue_Context *queue_context ) @@ -78,7 +97,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Acquire_critical( * @param[in, out] the_semaphore The semaphore to release. * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release( +static inline void _CORE_semaphore_Release( CORE_semaphore_Control *the_semaphore, Thread_queue_Context *queue_context ) @@ -95,7 +114,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release( * @param operations The thread queue operations. * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy( +static inline void _CORE_semaphore_Destroy( CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, Thread_queue_Context *queue_context @@ -126,30 +145,28 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy( * @retval STATUS_SUCCESSFUL The unit was successfully freed to the semaphore. * @retval STATUS_MAXIMUM_COUNT_EXCEEDED The maximum number of units was exceeded. */ -RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Surrender( +static inline Status_Control _CORE_semaphore_Surrender( CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, uint32_t maximum_count, Thread_queue_Context *queue_context ) { - Thread_Control *the_thread; - Status_Control status; + Status_Control status; + Thread_queue_Heads *heads; status = STATUS_SUCCESSFUL; _CORE_semaphore_Acquire_critical( the_semaphore, queue_context ); - the_thread = _Thread_queue_First_locked( - &the_semaphore->Wait_queue, - operations - ); - if ( the_thread != NULL ) { - _Thread_queue_Extract_critical( + heads = the_semaphore->Wait_queue.Queue.heads; + + if ( heads != NULL ) { + _Thread_queue_Surrender_no_priority( &the_semaphore->Wait_queue.Queue, - operations, - the_thread, - queue_context + heads, + queue_context, + operations ); } else { if ( the_semaphore->count < maximum_count ) @@ -170,7 +187,7 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Surrender( * * @return the current count of this semaphore. */ -RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count( +static inline uint32_t _CORE_semaphore_Get_count( const CORE_semaphore_Control *the_semaphore ) { @@ -195,9 +212,9 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count( * @retval STATUS_SUCCESSFUL The semaphore was successfully seized. * @retval STATUS_UNSATISFIED The semaphore is currently not free and the * calling thread not willing to wait. - * @retval STATUS_TIMEOUT A timeout occured. + * @retval STATUS_TIMEOUT A timeout occurred. */ -RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Seize( +static inline Status_Control _CORE_semaphore_Seize( CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, Thread_Control *executing, |