summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/scheduleredfblock.c17
-rw-r--r--cpukit/score/src/scheduleredfschedule.c12
-rw-r--r--cpukit/score/src/scheduleredfyield.c9
-rw-r--r--cpukit/score/src/schedulerpriorityblock.c16
-rw-r--r--cpukit/score/src/schedulerpriorityschedule.c4
-rw-r--r--cpukit/score/src/schedulersimpleblock.c15
-rw-r--r--cpukit/score/src/schedulersimpleschedule.c9
-rw-r--r--cpukit/score/src/schedulersimplesmp.c4
-rw-r--r--cpukit/score/src/schedulersimpleyield.c5
-rw-r--r--cpukit/score/src/threadchangepriority.c14
10 files changed, 40 insertions, 65 deletions
diff --git a/cpukit/score/src/scheduleredfblock.c b/cpukit/score/src/scheduleredfblock.c
index 4ad767d7bf..80bb1d5549 100644
--- a/cpukit/score/src/scheduleredfblock.c
+++ b/cpukit/score/src/scheduleredfblock.c
@@ -19,20 +19,15 @@
#include "config.h"
#endif
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/threadimpl.h>
+#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Block(
Thread_Control *the_thread
)
{
- _Scheduler_EDF_Extract( the_thread );
-
- /* TODO: flash critical section? */
-
- if ( _Thread_Is_heir( the_thread ) )
- _Scheduler_EDF_Schedule();
-
- if ( _Thread_Is_executing( the_thread ) )
- _Thread_Dispatch_necessary = true;
+ _Scheduler_Generic_block(
+ _Scheduler_EDF_Extract,
+ _Scheduler_EDF_Schedule_body,
+ the_thread
+ );
}
diff --git a/cpukit/score/src/scheduleredfschedule.c b/cpukit/score/src/scheduleredfschedule.c
index dbe21dc491..a71a5b52ba 100644
--- a/cpukit/score/src/scheduleredfschedule.c
+++ b/cpukit/score/src/scheduleredfschedule.c
@@ -18,15 +18,9 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/scheduleredf.h>
+#include <rtems/score/scheduleredfimpl.h>
-void _Scheduler_EDF_Schedule(void)
+void _Scheduler_EDF_Schedule( Thread_Control *thread )
{
- RBTree_Node *first = _RBTree_First(&_Scheduler_EDF_Ready_queue, RBT_LEFT);
- Scheduler_EDF_Per_thread *sched_info =
- _RBTree_Container_of(first, Scheduler_EDF_Per_thread, Node);
-
- _Thread_Heir = (Thread_Control *) sched_info->thread;
+ _Scheduler_EDF_Schedule_body( thread, false );
}
diff --git a/cpukit/score/src/scheduleredfyield.c b/cpukit/score/src/scheduleredfyield.c
index 4ba9f79b77..fc5b13a7a0 100644
--- a/cpukit/score/src/scheduleredfyield.c
+++ b/cpukit/score/src/scheduleredfyield.c
@@ -19,11 +19,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Yield( Thread_Control *thread )
{
@@ -44,8 +40,7 @@ void _Scheduler_EDF_Yield( Thread_Control *thread )
_ISR_Flash( level );
- _Scheduler_EDF_Schedule();
- _Thread_Dispatch_necessary = true;
+ _Scheduler_EDF_Schedule_body( thread, false );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c
index 9e48101f9e..329ddd7bda 100644
--- a/cpukit/score/src/schedulerpriorityblock.c
+++ b/cpukit/score/src/schedulerpriorityblock.c
@@ -21,20 +21,14 @@
#endif
#include <rtems/score/schedulerpriorityimpl.h>
-#include <rtems/score/threadimpl.h>
void _Scheduler_priority_Block(
Thread_Control *the_thread
)
{
- _Scheduler_priority_Ready_queue_extract( the_thread );
-
- /* TODO: flash critical section? */
-
- if ( _Thread_Is_heir( the_thread ) )
- _Scheduler_priority_Schedule_body();
-
- if ( _Thread_Is_executing( the_thread ) )
- _Thread_Dispatch_necessary = true;
-
+ _Scheduler_Generic_block(
+ _Scheduler_priority_Ready_queue_extract,
+ _Scheduler_priority_Schedule_body,
+ the_thread
+ );
}
diff --git a/cpukit/score/src/schedulerpriorityschedule.c b/cpukit/score/src/schedulerpriorityschedule.c
index 22ed5f403c..42647e617b 100644
--- a/cpukit/score/src/schedulerpriorityschedule.c
+++ b/cpukit/score/src/schedulerpriorityschedule.c
@@ -20,7 +20,7 @@
#include <rtems/score/schedulerpriorityimpl.h>
-void _Scheduler_priority_Schedule(void)
+void _Scheduler_priority_Schedule( Thread_Control *thread )
{
- _Scheduler_priority_Schedule_body();
+ _Scheduler_priority_Schedule_body( thread, false );
}
diff --git a/cpukit/score/src/schedulersimpleblock.c b/cpukit/score/src/schedulersimpleblock.c
index b9753b5954..1e6e8a0b47 100644
--- a/cpukit/score/src/schedulersimpleblock.c
+++ b/cpukit/score/src/schedulersimpleblock.c
@@ -19,18 +19,15 @@
#include "config.h"
#endif
-#include <rtems/score/schedulersimple.h>
-#include <rtems/score/threadimpl.h>
+#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Block(
Thread_Control *the_thread
)
{
- _Scheduler_simple_Extract(the_thread);
-
- if ( _Thread_Is_heir( the_thread ) )
- _Scheduler_simple_Schedule();
-
- if ( _Thread_Is_executing( the_thread ) )
- _Thread_Dispatch_necessary = true;
+ _Scheduler_Generic_block(
+ _Scheduler_simple_Extract,
+ _Scheduler_simple_Schedule_body,
+ the_thread
+ );
}
diff --git a/cpukit/score/src/schedulersimpleschedule.c b/cpukit/score/src/schedulersimpleschedule.c
index b60f096b09..5018e0b638 100644
--- a/cpukit/score/src/schedulersimpleschedule.c
+++ b/cpukit/score/src/schedulersimpleschedule.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <rtems/score/schedulersimple.h>
-#include <rtems/score/chainimpl.h>
+#include <rtems/score/schedulersimpleimpl.h>
-void _Scheduler_simple_Schedule(void)
+void _Scheduler_simple_Schedule( Thread_Control *thread )
{
- _Thread_Heir = (Thread_Control *) _Chain_First(
- (Chain_Control *) _Scheduler.information
- );
+ _Scheduler_simple_Schedule_body( thread, false );
}
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index db08b96ab3..e26151025c 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -182,9 +182,9 @@ void _Scheduler_simple_smp_Yield( Thread_Control *thread )
_ISR_Enable( level );
}
-void _Scheduler_simple_smp_Schedule( void )
+void _Scheduler_simple_smp_Schedule( Thread_Control *thread )
{
- /* Nothing to do */
+ ( void ) thread;
}
void _Scheduler_simple_smp_Start_idle(
diff --git a/cpukit/score/src/schedulersimpleyield.c b/cpukit/score/src/schedulersimpleyield.c
index cb8dc6fc92..43784d65f9 100644
--- a/cpukit/score/src/schedulersimpleyield.c
+++ b/cpukit/score/src/schedulersimpleyield.c
@@ -32,10 +32,7 @@ void _Scheduler_simple_Yield( Thread_Control *thread )
_ISR_Flash( level );
- _Scheduler_simple_Schedule();
-
- if ( !_Thread_Is_heir( thread ) )
- _Thread_Dispatch_necessary = true;
+ _Scheduler_simple_Schedule_body( thread, false );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index b4437313a7..b3d79844c2 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -62,6 +62,15 @@ void _Thread_Change_priority(
/* Only clear the transient state if it wasn't set already */
if ( ! _States_Is_transient( original_state ) )
the_thread->current_state = _States_Clear( STATES_TRANSIENT, state );
+
+ /*
+ * The thread may have new blocking states added by interrupt service
+ * routines after the change into the transient state. This will not
+ * result in a _Scheduler_Block() operation. Make sure we select an heir
+ * now.
+ */
+ _Scheduler_Schedule( the_thread );
+
_ISR_Enable( level );
if ( _States_Is_waiting_on_thread_queue( state ) ) {
_Thread_queue_Requeue( the_thread->Wait.queue, the_thread );
@@ -91,10 +100,7 @@ void _Thread_Change_priority(
* We altered the set of thread priorities. So let's figure out
* who is the heir and if we need to switch to them.
*/
- _Scheduler_Schedule();
+ _Scheduler_Schedule( the_thread );
- if ( !_Thread_Is_executing_also_the_heir() &&
- _Thread_Executing->is_preemptible )
- _Thread_Dispatch_necessary = true;
_ISR_Enable( level );
}