summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/semsetpriority.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-07 11:48:36 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-11 09:05:07 +0100
commit01f8c12ee57230fca1581e1b5be91f3decba0488 (patch)
tree279ef8193d107ea59490e3fdeb18d20639c54f36 /cpukit/rtems/src/semsetpriority.c
parentscore: Optimize _TLS_Get_size() (diff)
downloadrtems-01f8c12ee57230fca1581e1b5be91f3decba0488.tar.bz2
rtems: Optimize semaphore control block
Move variant, discipline, and global information to flags stored in a node pointer of active semaphores. Update #3833.
Diffstat (limited to 'cpukit/rtems/src/semsetpriority.c')
-rw-r--r--cpukit/rtems/src/semsetpriority.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/cpukit/rtems/src/semsetpriority.c b/cpukit/rtems/src/semsetpriority.c
index 508dca5a12..772f30c0c9 100644
--- a/cpukit/rtems/src/semsetpriority.c
+++ b/cpukit/rtems/src/semsetpriority.c
@@ -47,6 +47,7 @@ static rtems_status_code _Semaphore_Set_priority(
Priority_Control core_priority;
Priority_Control old_priority;
Per_CPU_Control *cpu_self;
+ Semaphore_Variant variant;
core_priority = _RTEMS_Priority_To_core( scheduler, new_priority, &valid );
if ( new_priority != RTEMS_CURRENT_PRIORITY && !valid ) {
@@ -59,8 +60,9 @@ static rtems_status_code _Semaphore_Set_priority(
&the_semaphore->Core_control.Wait_queue,
queue_context
);
+ variant = _Semaphore_Get_variant( _Semaphore_Get_flags( the_semaphore ) );
- switch ( the_semaphore->variant ) {
+ switch ( variant ) {
case SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING:
sc = _Semaphore_Is_scheduler_valid(
&the_semaphore->Core_control.Mutex,
@@ -100,10 +102,10 @@ static rtems_status_code _Semaphore_Set_priority(
#endif
default:
_Assert(
- the_semaphore->variant == SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY
- || the_semaphore->variant == SEMAPHORE_VARIANT_MUTEX_NO_PROTOCOL
- || the_semaphore->variant == SEMAPHORE_VARIANT_SIMPLE_BINARY
- || the_semaphore->variant == SEMAPHORE_VARIANT_COUNTING
+ variant == SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY
+ || variant == SEMAPHORE_VARIANT_MUTEX_NO_PROTOCOL
+ || variant == SEMAPHORE_VARIANT_SIMPLE_BINARY
+ || variant == SEMAPHORE_VARIANT_COUNTING
);
old_priority = 0;
sc = RTEMS_NOT_DEFINED;