score: Add and use Thread_Control::is_idle

Update #2797.
This commit is contained in:
Sebastian Huber
2016-11-07 16:54:40 +01:00
parent e6107854b2
commit 1f5bee3d85
7 changed files with 8 additions and 22 deletions

View File

@@ -139,9 +139,7 @@ rtems_isr Clock_isr(
if (!rtems_configuration_is_smp_enabled()) {
while (
_Thread_Heir == _Thread_Executing
&& _Thread_Executing->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task()
_Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle
) {
ISR_lock_Context lock_context;

View File

@@ -132,8 +132,7 @@ void Clock_isr(void *arg_unused)
#ifdef CLOCK_DRIVER_USE_FAST_IDLE
do {
tlib_tc_tick();
} while ( _Thread_Executing == _Thread_Idle &&
_Thread_Heir == _Thread_Executing);
} while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle );
return;

View File

@@ -37,11 +37,7 @@ static rtems_isr clockISR(rtems_vector_number vector) {
#if CLOCK_DRIVER_USE_FAST_IDLE
do {
rtems_clock_tick();
} while (
_Thread_Heir == _Thread_Executing
&& _Thread_Executing->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task()
);
} while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle );
#else
rtems_clock_tick();
#endif

View File

@@ -105,11 +105,7 @@ static void clockHandler(void)
tb = ppc_time_base();
rtems_timecounter_tick();
while (
_Thread_Heir == _Thread_Executing
&& _Thread_Executing->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task()
) {
while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle ) {
tb += Clock_Decrementer_value;
ppc_set_time_base( tb );
rtems_timecounter_tick();

View File

@@ -754,6 +754,8 @@ struct _Thread_Control {
SMP_lock_Stats Potpourri_stats;
#endif
/** This field is true if the thread is an idle thread. */
bool is_idle;
#if defined(RTEMS_MULTIPROCESSING)
/** This field is true if the thread is offered globally */
bool is_global;

View File

@@ -72,6 +72,7 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
cpu->heir =
cpu->executing = idle;
idle->is_idle = true;
idle->Start.Entry.adaptor = _Thread_Entry_adaptor_idle;
idle->Start.Entry.Kinds.Idle.entry = rtems_configuration_get_idle_task();

View File

@@ -173,18 +173,12 @@ bool interrupt_critical_section_test_support_delay(void)
return interrupt_critical_busy_wait();
}
static bool is_idle( const Thread_Control *thread )
{
return thread->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task();
}
static void thread_switch( Thread_Control *executing, Thread_Control *heir )
{
(void) executing;
(void) heir;
if ( interrupt_critical.t1 == 0 && is_idle( heir ) ) {
if ( interrupt_critical.t1 == 0 && heir->is_idle ) {
interrupt_critical.t1 = rtems_clock_get_uptime_nanoseconds();
}
}