Modified calls to _Thread_Change_priority to take a third argument. The new

argument indicates whether the task is to be placed at the head or tail of
its priority fifo when it is lowering its own priority.  POSIX normally
follows the RTEMS API conventions but GNAT expects that all lowering of
a task's priority by the task itself will result in being placed at the
head of the priority FIFO.  Normally, this would only occur as the result
of lose of inherited priority.
This commit is contained in:
Joel Sherrill
1997-03-08 03:51:55 +00:00
parent dab057a9b3
commit f926b34f66
9 changed files with 98 additions and 29 deletions

View File

@@ -77,7 +77,7 @@ void _POSIX_Threads_Sporadic_budget_TSR(
if ( the_thread->resource_count == 0 ||
the_thread->current_priority > new_priority )
_Thread_Change_priority( the_thread, new_priority );
_Thread_Change_priority( the_thread, new_priority, TRUE );
ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period );
@@ -114,7 +114,7 @@ void _POSIX_Threads_Sporadic_budget_callout(
if ( the_thread->resource_count == 0 ||
the_thread->current_priority > new_priority )
_Thread_Change_priority( the_thread, new_priority );
_Thread_Change_priority( the_thread, new_priority, TRUE );
}
/*PAGE
@@ -656,7 +656,11 @@ int pthread_setschedparam(
the_thread->real_priority =
_POSIX_Priority_To_core( api->schedparam.sched_priority );
_Thread_Change_priority( the_thread, the_thread->real_priority );
_Thread_Change_priority(
the_thread,
the_thread->real_priority,
TRUE
);
break;
case SCHED_SPORADIC:

View File

@@ -561,7 +561,8 @@ void _Thread_Delay_ended(
void _Thread_Change_priority (
Thread_Control *the_thread,
Priority_Control new_priority
Priority_Control new_priority,
boolean prepend_it
);
/*

View File

@@ -561,7 +561,8 @@ void _Thread_Delay_ended(
void _Thread_Change_priority (
Thread_Control *the_thread,
Priority_Control new_priority
Priority_Control new_priority,
boolean prepend_it
);
/*

View File

@@ -142,7 +142,8 @@ void _CORE_mutex_Seize(
executing->current_priority ) {
_Thread_Change_priority(
the_mutex->holder,
the_mutex->Attributes.priority_ceiling
the_mutex->Attributes.priority_ceiling,
FALSE
);
}
}
@@ -180,7 +181,8 @@ void _CORE_mutex_Seize(
if ( the_mutex->holder->current_priority > executing->current_priority ) {
_Thread_Change_priority(
the_mutex->holder,
executing->current_priority
executing->current_priority,
FALSE
);
}
break;
@@ -199,7 +201,8 @@ void _CORE_mutex_Seize(
executing->current_priority ) {
_Thread_Change_priority(
executing,
the_mutex->Attributes.priority_ceiling
the_mutex->Attributes.priority_ceiling,
FALSE
);
};
break;
@@ -263,9 +266,8 @@ CORE_mutex_Status _CORE_mutex_Surrender(
case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
if ( executing->resource_count == 0 &&
executing->real_priority !=
executing->current_priority ) {
_Thread_Change_priority( executing, executing->real_priority );
executing->real_priority != executing->current_priority ) {
_Thread_Change_priority( executing, executing->real_priority, TRUE );
}
break;
}

View File

@@ -1206,6 +1206,7 @@ void _Thread_Delay_ended(
* Input parameters:
* the_thread - pointer to thread control block
* new_priority - ultimate priority
* prepend_it - TRUE if the thread should be prepended to the chain
*
* Output parameters: NONE
*
@@ -1216,10 +1217,34 @@ void _Thread_Delay_ended(
void _Thread_Change_priority(
Thread_Control *the_thread,
Priority_Control new_priority
Priority_Control new_priority,
boolean prepend_it
)
{
ISR_Level level;
/* boolean do_prepend = FALSE; */
/*
* If this is a case where prepending the task to its priority is
* potentially desired, then we need to consider whether to do it.
* This usually occurs when a task lowers its priority implcitly as
* the result of losing inherited priority. Normal explicit priority
* change calls (e.g. rtems_task_set_priority) should always do an
* append not a prepend.
*/
/*
* Techically, the prepend should conditional on the thread lowering
* its priority but that does allow cxd2004 of the acvc 2.0.1 to
* pass with rtems 4.0.0. This should change when gnat redoes its
* priority scheme.
*/
/*
if ( prepend_it &&
_Thread_Is_executing( the_thread ) &&
new_priority >= the_thread->current_priority )
prepend_it = TRUE;
*/
_Thread_Set_transient( the_thread );
@@ -1237,6 +1262,9 @@ void _Thread_Change_priority(
}
_Priority_Add_to_bit_map( &the_thread->Priority_map );
if ( prepend_it )
_Chain_Prepend_unprotected( the_thread->ready, &the_thread->Object.Node );
else
_Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node );
_ISR_Flash( level );
@@ -1246,7 +1274,6 @@ void _Thread_Change_priority(
if ( !_Thread_Is_executing_also_the_heir() &&
_Thread_Executing->is_preemptible )
_Context_Switch_necessary = TRUE;
_ISR_Enable( level );
}

View File

@@ -77,7 +77,7 @@ void _POSIX_Threads_Sporadic_budget_TSR(
if ( the_thread->resource_count == 0 ||
the_thread->current_priority > new_priority )
_Thread_Change_priority( the_thread, new_priority );
_Thread_Change_priority( the_thread, new_priority, TRUE );
ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period );
@@ -114,7 +114,7 @@ void _POSIX_Threads_Sporadic_budget_callout(
if ( the_thread->resource_count == 0 ||
the_thread->current_priority > new_priority )
_Thread_Change_priority( the_thread, new_priority );
_Thread_Change_priority( the_thread, new_priority, TRUE );
}
/*PAGE
@@ -656,7 +656,11 @@ int pthread_setschedparam(
the_thread->real_priority =
_POSIX_Priority_To_core( api->schedparam.sched_priority );
_Thread_Change_priority( the_thread, the_thread->real_priority );
_Thread_Change_priority(
the_thread,
the_thread->real_priority,
TRUE
);
break;
case SCHED_SPORADIC:

View File

@@ -561,7 +561,8 @@ void _Thread_Delay_ended(
void _Thread_Change_priority (
Thread_Control *the_thread,
Priority_Control new_priority
Priority_Control new_priority,
boolean prepend_it
);
/*

View File

@@ -142,7 +142,8 @@ void _CORE_mutex_Seize(
executing->current_priority ) {
_Thread_Change_priority(
the_mutex->holder,
the_mutex->Attributes.priority_ceiling
the_mutex->Attributes.priority_ceiling,
FALSE
);
}
}
@@ -180,7 +181,8 @@ void _CORE_mutex_Seize(
if ( the_mutex->holder->current_priority > executing->current_priority ) {
_Thread_Change_priority(
the_mutex->holder,
executing->current_priority
executing->current_priority,
FALSE
);
}
break;
@@ -199,7 +201,8 @@ void _CORE_mutex_Seize(
executing->current_priority ) {
_Thread_Change_priority(
executing,
the_mutex->Attributes.priority_ceiling
the_mutex->Attributes.priority_ceiling,
FALSE
);
};
break;
@@ -263,9 +266,8 @@ CORE_mutex_Status _CORE_mutex_Surrender(
case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
if ( executing->resource_count == 0 &&
executing->real_priority !=
executing->current_priority ) {
_Thread_Change_priority( executing, executing->real_priority );
executing->real_priority != executing->current_priority ) {
_Thread_Change_priority( executing, executing->real_priority, TRUE );
}
break;
}

View File

@@ -1206,6 +1206,7 @@ void _Thread_Delay_ended(
* Input parameters:
* the_thread - pointer to thread control block
* new_priority - ultimate priority
* prepend_it - TRUE if the thread should be prepended to the chain
*
* Output parameters: NONE
*
@@ -1216,10 +1217,34 @@ void _Thread_Delay_ended(
void _Thread_Change_priority(
Thread_Control *the_thread,
Priority_Control new_priority
Priority_Control new_priority,
boolean prepend_it
)
{
ISR_Level level;
/* boolean do_prepend = FALSE; */
/*
* If this is a case where prepending the task to its priority is
* potentially desired, then we need to consider whether to do it.
* This usually occurs when a task lowers its priority implcitly as
* the result of losing inherited priority. Normal explicit priority
* change calls (e.g. rtems_task_set_priority) should always do an
* append not a prepend.
*/
/*
* Techically, the prepend should conditional on the thread lowering
* its priority but that does allow cxd2004 of the acvc 2.0.1 to
* pass with rtems 4.0.0. This should change when gnat redoes its
* priority scheme.
*/
/*
if ( prepend_it &&
_Thread_Is_executing( the_thread ) &&
new_priority >= the_thread->current_priority )
prepend_it = TRUE;
*/
_Thread_Set_transient( the_thread );
@@ -1237,6 +1262,9 @@ void _Thread_Change_priority(
}
_Priority_Add_to_bit_map( &the_thread->Priority_map );
if ( prepend_it )
_Chain_Prepend_unprotected( the_thread->ready, &the_thread->Object.Node );
else
_Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node );
_ISR_Flash( level );
@@ -1246,7 +1274,6 @@ void _Thread_Change_priority(
if ( !_Thread_Is_executing_also_the_heir() &&
_Thread_Executing->is_preemptible )
_Context_Switch_necessary = TRUE;
_ISR_Enable( level );
}