summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-03-25 09:11:26 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-01 20:24:57 +0200
commit9c0591f12d450401746bc0bf7cd7a0e0b14a5f3b (patch)
tree02640af241b723d162024131701a0b518c961bf8 /cpukit/posix/src
parentscore: Document Futex Handler (diff)
downloadrtems-9c0591f12d450401746bc0bf7cd7a0e0b14a5f3b.tar.bz2
score: Fix priority discipline handling
The priority queues in clustered scheduling configurations use a per scheduler priority queue rotation to ensure FIFO fairness across schedulers. This mechanism is implemented in the thread queue surrender operation. Unfortunately some semaphore and message queue directives used wrongly the thread queue extract operation. Fix this through the use of _Thread_queue_Surrender(). Update #4358.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/condsignalsupp.c31
-rw-r--r--cpukit/posix/src/sempost.c14
2 files changed, 18 insertions, 27 deletions
diff --git a/cpukit/posix/src/condsignalsupp.c b/cpukit/posix/src/condsignalsupp.c
index dd3886ae69..188e61ec75 100644
--- a/cpukit/posix/src/condsignalsupp.c
+++ b/cpukit/posix/src/condsignalsupp.c
@@ -35,36 +35,33 @@ int _POSIX_Condition_variables_Signal_support(
{
POSIX_Condition_variables_Control *the_cond;
unsigned long flags;
- const Thread_queue_Operations *operations;
- Thread_queue_Heads *heads;
+ Thread_queue_Context queue_context;
the_cond = _POSIX_Condition_variables_Get( cond );
POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags );
- operations = POSIX_CONDITION_VARIABLES_TQ_OPERATIONS;
+ _Thread_queue_Context_initialize( &queue_context );
do {
- Thread_queue_Context queue_context;
+ Thread_queue_Heads *heads;
- _Thread_queue_Context_initialize( &queue_context );
_POSIX_Condition_variables_Acquire( the_cond, &queue_context );
heads = the_cond->Queue.Queue.heads;
- if ( heads != NULL ) {
- Thread_Control *the_thread;
-
- the_thread = ( *operations->first )( heads );
- _Thread_queue_Extract_critical(
- &the_cond->Queue.Queue,
- operations,
- the_thread,
- &queue_context
- );
- } else {
+ if ( heads == NULL ) {
the_cond->mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
_POSIX_Condition_variables_Release( the_cond, &queue_context );
+
+ return 0;
}
- } while ( is_broadcast && heads != NULL );
+
+ _Thread_queue_Surrender_no_priority(
+ &the_cond->Queue.Queue,
+ heads,
+ &queue_context,
+ POSIX_CONDITION_VARIABLES_TQ_OPERATIONS
+ );
+ } while ( is_broadcast );
return 0;
}
diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c
index f1fb7fa693..49142b25a2 100644
--- a/cpukit/posix/src/sempost.c
+++ b/cpukit/posix/src/sempost.c
@@ -47,18 +47,12 @@ int sem_post( sem_t *_sem )
}
if ( RTEMS_PREDICT_TRUE( heads != NULL ) ) {
- const Thread_queue_Operations *operations;
- Thread_Control *first;
-
_Thread_queue_Context_set_ISR_level( &queue_context, level );
- operations = SEMAPHORE_TQ_OPERATIONS;
- first = ( *operations->first )( heads );
-
- _Thread_queue_Extract_critical(
+ _Thread_queue_Surrender_no_priority(
&sem->Queue.Queue,
- operations,
- first,
- &queue_context
+ heads,
+ &queue_context,
+ SEMAPHORE_TQ_OPERATIONS
);
return 0;
}