summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threaddispatch.c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2011-05-26 18:07:07 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2011-05-26 18:07:07 +0000
commitd4dc7c8196355f08044e67a3f5c1e19485f17ff1 (patch)
tree77437e47925428753b579caadf1e7b61f524ee4d /cpukit/score/src/threaddispatch.c
parentFix broken cvs id. (diff)
downloadrtems-d4dc7c8196355f08044e67a3f5c1e19485f17ff1.tar.bz2
2011-05-26 Jennifer Averett <Jennifer.Averett@OARcorp.com>
PR 1796/cpukit * sapi/src/exshutdown.c, score/include/rtems/score/percpu.h, score/include/rtems/score/smp.h, score/src/smp.c, score/src/threaddispatch.c, score/src/threadhandler.c: Added SMP interprocess communications.
Diffstat (limited to 'cpukit/score/src/threaddispatch.c')
-rw-r--r--cpukit/score/src/threaddispatch.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index a5b5cf94c5..38d24a5017 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -33,6 +33,10 @@
#include <rtems/score/timestamp.h>
#endif
+#if defined(RTEMS_SMP)
+ #include <rtems/score/smp.h>
+#endif
+
/**
* _Thread_Dispatch
*
@@ -47,18 +51,28 @@
* dispatch thread
* no dispatch thread
*/
-
void _Thread_Dispatch( void )
{
Thread_Control *executing;
Thread_Control *heir;
ISR_Level level;
+ _Thread_Disable_dispatch();
+ #if defined(RTEMS_SMP)
+ /*
+ * If necessary, send dispatch request to other cores.
+ */
+ _SMP_Request_other_cores_to_dispatch();
+ #endif
+
+ /*
+ * Now determine if we need to perform a dispatch on the current CPU.
+ */
executing = _Thread_Executing;
_ISR_Disable( level );
while ( _Thread_Dispatch_necessary == true ) {
+
heir = _Thread_Heir;
- _Thread_Dispatch_set_disable_level( 1 );
_Thread_Dispatch_necessary = false;
_Thread_Executing = heir;
@@ -96,7 +110,10 @@ void _Thread_Dispatch( void )
_Thread_Time_of_last_context_switch = uptime;
}
#else
- heir->cpu_time_used++;
+ {
+ TOD_Get_uptime( &_Thread_Time_of_last_context_switch );
+ heir->cpu_time_used++;
+ }
#endif
/*