[PATCH 1/2] score: Fix _CORE_ceiling_mutex_Set_priority()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Mar 24 07:40:40 UTC 2021
We have to use a second thread queue context to acquire and release the
thread wait lock.
Close #4356.
---
cpukit/include/rtems/score/coremuteximpl.h | 13 +++++++------
cpukit/rtems/src/semsetpriority.c | 3 +--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/cpukit/include/rtems/score/coremuteximpl.h b/cpukit/include/rtems/score/coremuteximpl.h
index cbc1e720fb..e8d72e5d25 100644
--- a/cpukit/include/rtems/score/coremuteximpl.h
+++ b/cpukit/include/rtems/score/coremuteximpl.h
@@ -357,12 +357,10 @@ _CORE_ceiling_mutex_Get_scheduler(
*
* @param[out] the_mutex The ceiling mutex to set the priority of.
* @param priority_ceiling The new priority ceiling of the mutex.
- * @param queue_context The thread queue context.
*/
RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Set_priority(
CORE_ceiling_mutex_Control *the_mutex,
- Priority_Control priority_ceiling,
- Thread_queue_Context *queue_context
+ Priority_Control priority_ceiling
)
{
Thread_Control *owner;
@@ -370,15 +368,18 @@ RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Set_priority(
owner = _CORE_mutex_Get_owner( &the_mutex->Recursive.Mutex );
if ( owner != NULL ) {
- _Thread_Wait_acquire( owner, queue_context );
+ Thread_queue_Context queue_context;
+
+ _Thread_queue_Context_initialize( &queue_context );
+ _Thread_Wait_acquire_critical( owner, &queue_context );
_Thread_Priority_change(
owner,
&the_mutex->Priority_ceiling,
priority_ceiling,
false,
- queue_context
+ &queue_context
);
- _Thread_Wait_release( owner, queue_context );
+ _Thread_Wait_release_critical( owner, &queue_context );
} else {
the_mutex->Priority_ceiling.priority = priority_ceiling;
}
diff --git a/cpukit/rtems/src/semsetpriority.c b/cpukit/rtems/src/semsetpriority.c
index adb0320210..119dd85d77 100644
--- a/cpukit/rtems/src/semsetpriority.c
+++ b/cpukit/rtems/src/semsetpriority.c
@@ -85,8 +85,7 @@ static rtems_status_code _Semaphore_Set_priority(
if ( sc == RTEMS_SUCCESSFUL && new_priority != RTEMS_CURRENT_PRIORITY ) {
_CORE_ceiling_mutex_Set_priority(
&the_semaphore->Core_control.Mutex,
- core_priority,
- queue_context
+ core_priority
);
}
--
2.26.2
More information about the devel
mailing list