diff options
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/threadqops.c | 70 |
1 files changed, 43 insertions, 27 deletions
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c index a42876cf09..9a09b4c442 100644 --- a/cpukit/score/src/threadqops.c +++ b/cpukit/score/src/threadqops.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -10,17 +12,28 @@ */ /* - * Copyright (c) 2015, 2021 embedded brains GmbH. All rights reserved. + * Copyright (C) 2015, 2021 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * 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. + * 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. */ #ifdef HAVE_CONFIG_H @@ -59,17 +72,6 @@ void _Thread_queue_Do_nothing_priority_actions( _Priority_Actions_initialize_empty( priority_actions ); } -static void _Thread_queue_Do_nothing_extract( - Thread_queue_Queue *queue, - Thread_Control *the_thread, - Thread_queue_Context *queue_context -) -{ - (void) queue; - (void) the_thread; - (void) queue_context; -} - static void _Thread_queue_Queue_enqueue( Thread_queue_Queue *queue, Thread_Control *the_thread, @@ -154,6 +156,8 @@ static void _Thread_queue_FIFO_do_initialize( { Scheduler_Node *scheduler_node; + (void) queue; + (void) queue_context; scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Chain_Initialize_node( &scheduler_node->Wait.Priority.Node.Node.Chain ); @@ -289,6 +293,7 @@ static Thread_queue_Priority_queue *_Thread_queue_Priority_queue_by_index( ) { #if defined(RTEMS_SMP) + _Assert( scheduler_index < _Scheduler_Count ); return &heads->Priority[ scheduler_index ]; #else (void) scheduler_index; @@ -402,8 +407,12 @@ static void _Thread_queue_Priority_priority_actions( break; } +#if defined(RTEMS_SMP) priority_aggregation = _Priority_Get_next_action( priority_aggregation ); - } while ( _Priority_Actions_is_valid( priority_aggregation ) ); + } while ( priority_aggregation != NULL ); +#else + } while ( false ); +#endif } static void _Thread_queue_Priority_do_initialize( @@ -732,14 +741,18 @@ static void _Thread_queue_Priority_inherit_priority_actions( priority_aggregation = _Priority_Actions_move( priority_actions ); do { +#if defined(RTEMS_SMP) Priority_Aggregation *next_aggregation; +#endif Scheduler_Node *scheduler_node; size_t scheduler_index; Thread_queue_Priority_queue *priority_queue; Scheduler_Node *scheduler_node_of_owner; Priority_Action_type priority_action_type; +#if defined(RTEMS_SMP) next_aggregation = _Priority_Get_next_action( priority_aggregation ); +#endif scheduler_node = SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation ); scheduler_index = _Thread_queue_Scheduler_index( scheduler_node ); @@ -795,8 +808,12 @@ static void _Thread_queue_Priority_inherit_priority_actions( break; } +#if defined(RTEMS_SMP) priority_aggregation = next_aggregation; - } while ( _Priority_Actions_is_valid( priority_aggregation ) ); + } while ( priority_aggregation != NULL ); +#else + } while ( false ); +#endif } static void _Thread_queue_Priority_inherit_do_initialize( @@ -1197,7 +1214,7 @@ static void _Thread_queue_Priority_inherit_extract( * resolves the deadlock. Thread T1 and T2 can the complete their * operations. */ - _Thread_queue_Path_acquire_critical( queue, the_thread, queue_context ); + (void) _Thread_queue_Path_acquire( queue, the_thread, queue_context ); #endif _Thread_queue_Queue_extract( @@ -1210,7 +1227,7 @@ static void _Thread_queue_Priority_inherit_extract( ); #if defined(RTEMS_SMP) - _Thread_queue_Path_release_critical( queue_context ); + _Thread_queue_Path_release( queue_context ); #endif } @@ -1461,12 +1478,11 @@ static Thread_Control *_Thread_queue_Priority_inherit_surrender( } const Thread_queue_Operations _Thread_queue_Operations_default = { - .priority_actions = _Thread_queue_Do_nothing_priority_actions, - .extract = _Thread_queue_Do_nothing_extract + .priority_actions = _Thread_queue_Do_nothing_priority_actions /* * The default operations are only used in _Thread_Priority_apply() and * _Thread_Continue() and do not have a thread queue associated with them, so - * the enqueue and first operations are superfluous. + * the enqueue, extract, surrender, and first operations are superfluous. */ }; |