[rtems commit] score: Create thread implementation header

Sebastian Huber sebh at rtems.org
Fri Jul 26 09:51:53 UTC 2013


Module:    rtems
Branch:    master
Commit:    5618c37a7a49b7ddde7bb6f7fda8c10616779c05
Changeset: http://git.rtems.org/rtems/commit/?id=5618c37a7a49b7ddde7bb6f7fda8c10616779c05

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jul 24 15:14:48 2013 +0200

score: Create thread implementation header

Move implementation specific parts of thread.h and thread.inl into new
header file threadimpl.h.  The thread.h contains now only the
application visible API.

Remove superfluous header file includes from various files.

---

 cpukit/libcsupport/src/error.c                    |    1 +
 cpukit/libcsupport/src/newlibc_reent.c            |    1 +
 cpukit/posix/src/alarm.c                          |    6 +-
 cpukit/posix/src/cancel.c                         |    6 +-
 cpukit/posix/src/nanosleep.c                      |    2 +-
 cpukit/posix/src/psignalunblockthread.c           |    2 +-
 cpukit/posix/src/pthread.c                        |    2 +-
 cpukit/posix/src/pthreadcreate.c                  |    7 +-
 cpukit/posix/src/pthreaddetach.c                  |    3 +-
 cpukit/posix/src/pthreadequal.c                   |    3 +-
 cpukit/posix/src/pthreadexit.c                    |    5 +-
 cpukit/posix/src/pthreadgetschedparam.c           |    2 +-
 cpukit/posix/src/pthreadjoin.c                    |    3 +-
 cpukit/posix/src/pthreadkill.c                    |    2 +-
 cpukit/posix/src/pthreadsetschedparam.c           |    4 +-
 cpukit/posix/src/sched_rr_get_interval.c          |    2 +-
 cpukit/posix/src/ualarm.c                         |    8 +-
 cpukit/rtems/src/clocktick.c                      |    2 +-
 cpukit/rtems/src/eventseize.c                     |    1 +
 cpukit/rtems/src/eventsend.c                      |    1 +
 cpukit/rtems/src/eventsurrender.c                 |    1 +
 cpukit/rtems/src/eventtimeout.c                   |    1 +
 cpukit/rtems/src/msgmp.c                          |    1 +
 cpukit/rtems/src/msgqtranslatereturncode.c        |    2 +-
 cpukit/rtems/src/partmp.c                         |    1 +
 cpukit/rtems/src/ratemoncancel.c                  |    2 +-
 cpukit/rtems/src/ratemonperiod.c                  |    2 +-
 cpukit/rtems/src/ratemontimeout.c                 |    7 +-
 cpukit/rtems/src/regionmp.c                       |    1 +
 cpukit/rtems/src/signalmp.c                       |    1 +
 cpukit/rtems/src/signalsend.c                     |    9 +-
 cpukit/rtems/src/systemeventsend.c                |    1 +
 cpukit/rtems/src/taskcreate.c                     |   18 +-
 cpukit/rtems/src/taskdelete.c                     |   15 +-
 cpukit/rtems/src/taskgetnote.c                    |   15 +-
 cpukit/rtems/src/taskissuspended.c                |   15 +-
 cpukit/rtems/src/taskmode.c                       |   16 +-
 cpukit/rtems/src/taskmp.c                         |    1 +
 cpukit/rtems/src/taskrestart.c                    |   15 +-
 cpukit/rtems/src/taskresume.c                     |   13 +-
 cpukit/rtems/src/tasksetnote.c                    |   15 +-
 cpukit/rtems/src/tasksetpriority.c                |   13 +-
 cpukit/rtems/src/taskstart.c                      |   15 +-
 cpukit/rtems/src/tasksuspend.c                    |   13 +-
 cpukit/rtems/src/taskvariable_invoke_dtor.c       |    2 +-
 cpukit/rtems/src/taskvariableadd.c                |    6 +-
 cpukit/rtems/src/taskvariabledelete.c             |    4 +-
 cpukit/rtems/src/taskvariableget.c                |    4 +-
 cpukit/rtems/src/taskwakeafter.c                  |    4 +-
 cpukit/rtems/src/taskwakewhen.c                   |   15 +-
 cpukit/rtems/src/timerserver.c                    |   11 +-
 cpukit/sapi/src/exinit.c                          |    2 +-
 cpukit/sapi/src/exshutdown.c                      |    3 +-
 cpukit/score/Makefile.am                          |    2 +-
 cpukit/score/include/rtems/score/coremuteximpl.h  |    2 +-
 cpukit/score/include/rtems/score/thread.h         |  454 +-------------
 cpukit/score/include/rtems/score/threadimpl.h     |  691 +++++++++++++++++++++
 cpukit/score/include/rtems/score/threadmp.h       |    4 +
 cpukit/score/inline/rtems/score/thread.inl        |  275 --------
 cpukit/score/preinstall.am                        |    8 +-
 cpukit/score/src/corerwlocktimeout.c              |    3 +-
 cpukit/score/src/heap.c                           |    1 +
 cpukit/score/src/heapfree.c                       |    2 +-
 cpukit/score/src/mpci.c                           |    2 +-
 cpukit/score/src/objectgetnameasstring.c          |    6 +-
 cpukit/score/src/objectidtoname.c                 |    3 +-
 cpukit/score/src/schedulercbs.c                   |    2 +-
 cpukit/score/src/schedulercbsattachthread.c       |    6 +-
 cpukit/score/src/schedulercbsdetachthread.c       |    5 +-
 cpukit/score/src/schedulercbsgetexecutiontime.c   |    5 +-
 cpukit/score/src/schedulercbsgetremainingbudget.c |    5 +-
 cpukit/score/src/schedulercbsreleasejob.c         |    4 +-
 cpukit/score/src/schedulercbsunblock.c            |    1 +
 cpukit/score/src/schedulerdefaulttick.c           |    2 +-
 cpukit/score/src/scheduleredfblock.c              |    6 +-
 cpukit/score/src/scheduleredfreleasejob.c         |    4 +-
 cpukit/score/src/schedulerpriorityblock.c         |    1 +
 cpukit/score/src/schedulerpriorityyield.c         |    1 +
 cpukit/score/src/schedulersimpleblock.c           |    9 +-
 cpukit/score/src/schedulersimpleyield.c           |    1 +
 cpukit/score/src/smp.c                            |    4 +-
 cpukit/score/src/thread.c                         |   23 +-
 cpukit/score/src/threadblockingoperationcancel.c  |    3 +-
 cpukit/score/src/threadchangepriority.c           |    2 +-
 cpukit/score/src/threadclearstate.c               |    3 +-
 cpukit/score/src/threadclose.c                    |    4 +-
 cpukit/score/src/threadcreateidle.c               |   13 +-
 cpukit/score/src/threaddelayended.c               |   13 +-
 cpukit/score/src/threaddispatch.c                 |   20 +-
 cpukit/score/src/threadget.c                      |   12 +-
 cpukit/score/src/threadhandler.c                  |   16 +-
 cpukit/score/src/threadinitialize.c               |    6 +-
 cpukit/score/src/threadloadenv.c                  |   12 +-
 cpukit/score/src/threadmp.c                       |    2 +-
 cpukit/score/src/threadqdequeuefifo.c             |   10 +-
 cpukit/score/src/threadqdequeuepriority.c         |   10 +-
 cpukit/score/src/threadqenqueue.c                 |    9 +-
 cpukit/score/src/threadqextractfifo.c             |   10 +-
 cpukit/score/src/threadqextractpriority.c         |   10 +-
 cpukit/score/src/threadqprocesstimeout.c          |    8 +-
 cpukit/score/src/threadqtimeout.c                 |    9 +-
 cpukit/score/src/threadready.c                    |    4 +-
 cpukit/score/src/threadreset.c                    |   11 +-
 cpukit/score/src/threadrestart.c                  |   12 +-
 cpukit/score/src/threadsetpriority.c              |    2 +-
 cpukit/score/src/threadsetstate.c                 |    4 +-
 cpukit/score/src/threadsettransient.c             |    4 +-
 cpukit/score/src/threadstackallocate.c            |   12 +-
 cpukit/score/src/threadstackfree.c                |   12 +-
 cpukit/score/src/threadstart.c                    |    4 +-
 cpukit/score/src/threadstartmultitasking.c        |   12 +-
 testsuites/sptests/spsimplesched02/init.c         |    2 +
 testsuites/support/include/tmacros.h              |    3 +-
 113 files changed, 873 insertions(+), 1220 deletions(-)

diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c
index 6993ea1..9933e14 100644
--- a/cpukit/libcsupport/src/error.c
+++ b/cpukit/libcsupport/src/error.c
@@ -20,6 +20,7 @@
 #include <rtems/error.h>
 #include <rtems/assoc.h>
 #include <rtems/score/sysstate.h>
+#include <rtems/score/threadimpl.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdarg.h>
diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c
index 0e67472..50fd839 100644
--- a/cpukit/libcsupport/src/newlibc_reent.c
+++ b/cpukit/libcsupport/src/newlibc_reent.c
@@ -28,6 +28,7 @@
 #include <string.h>
 
 #include <rtems/libcsupport.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
 
 bool newlib_create_hook(
diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c
index be3a334..acdec65 100644
--- a/cpukit/posix/src/alarm.c
+++ b/cpukit/posix/src/alarm.c
@@ -21,12 +21,12 @@
 #include "config.h"
 #endif
 
-#include <pthread.h>
+#include <unistd.h>
 
-#include <rtems/system.h>
-#include <rtems/score/watchdogimpl.h>
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/psignalimpl.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdogimpl.h>
 
 /*
  *  _POSIX_signals_Alarm_TSR
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
index 9ea7f93..e896f1d 100644
--- a/cpukit/posix/src/cancel.c
+++ b/cpukit/posix/src/cancel.c
@@ -21,13 +21,9 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/posix/cancel.h>
-#include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/threadsup.h>
 
 /*
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index 84ac832..3c408eb 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -23,7 +23,7 @@
 
 #include <rtems/seterr.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/timespec.h>
 #include <rtems/score/tod.h>
 #include <rtems/score/watchdogimpl.h>
diff --git a/cpukit/posix/src/psignalunblockthread.c b/cpukit/posix/src/psignalunblockthread.c
index cbdbd38..51b034d 100644
--- a/cpukit/posix/src/psignalunblockthread.c
+++ b/cpukit/posix/src/psignalunblockthread.c
@@ -24,7 +24,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/threadq.h>
 #include <rtems/score/watchdogimpl.h>
 #include <rtems/score/wkspace.h>
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 3df7478..f4dcc21 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -26,7 +26,7 @@
 #include <rtems/config.h>
 #include <rtems/score/apiext.h>
 #include <rtems/score/stack.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/threadq.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/watchdogimpl.h>
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 4742b59..64270e9 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -24,14 +24,13 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
-#include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/priorityimpl.h>
+#include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/time.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/apimutex.h>
-#include <rtems/score/watchdogimpl.h>
 #include <rtems/score/stackimpl.h>
+#include <rtems/score/watchdogimpl.h>
 
 static inline size_t _POSIX_Threads_Ensure_minimum_stack (
   size_t size
diff --git a/cpukit/posix/src/pthreaddetach.c b/cpukit/posix/src/pthreaddetach.c
index 3b99a9c..74df253 100644
--- a/cpukit/posix/src/pthreaddetach.c
+++ b/cpukit/posix/src/pthreaddetach.c
@@ -21,9 +21,8 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
 #include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/threadimpl.h>
 
 /**
  * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
diff --git a/cpukit/posix/src/pthreadequal.c b/cpukit/posix/src/pthreadequal.c
index f398e5c..dd9c533 100644
--- a/cpukit/posix/src/pthreadequal.c
+++ b/cpukit/posix/src/pthreadequal.c
@@ -23,9 +23,8 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
 #include <rtems/posix/pthreadimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 
 int pthread_equal(
   pthread_t  t1,
diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c
index 03a56c9..296c32b 100644
--- a/cpukit/posix/src/pthreadexit.c
+++ b/cpukit/posix/src/pthreadexit.c
@@ -21,10 +21,9 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/score/apimutex.h>
-#include <rtems/score/thread.h>
 #include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/apimutex.h>
+#include <rtems/score/threadimpl.h>
 
 
 void _POSIX_Thread_Exit(
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index 7f034cb..6876e13 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -24,9 +24,9 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/priorityimpl.h>
+#include <rtems/score/threadimpl.h>
 
 int pthread_getschedparam(
   pthread_t           thread,
diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index 9dc1b24..18039d3 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -23,9 +23,8 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
 #include <rtems/posix/pthreadimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/threadq.h>
 
 int pthread_join(
diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c
index 02a9ee7..11287fa 100644
--- a/cpukit/posix/src/pthreadkill.c
+++ b/cpukit/posix/src/pthreadkill.c
@@ -24,10 +24,10 @@
 #include <signal.h>
 #include <errno.h>
 
-#include <rtems/system.h>
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/psignalimpl.h>
 #include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/seterr.h>
 
 int pthread_kill(
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index a8ac445..a54a689 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -25,11 +25,11 @@
 #include <pthread.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/score/watchdogimpl.h>
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/priorityimpl.h>
 #include <rtems/posix/time.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/watchdogimpl.h>
 
 int pthread_setschedparam(
   pthread_t           thread,
diff --git a/cpukit/posix/src/sched_rr_get_interval.c b/cpukit/posix/src/sched_rr_get_interval.c
index c606bc9..242077d 100644
--- a/cpukit/posix/src/sched_rr_get_interval.c
+++ b/cpukit/posix/src/sched_rr_get_interval.c
@@ -26,7 +26,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/tod.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/timespec.h>
 #include <rtems/seterr.h>
 
diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c
index e94eb12..17573ba 100644
--- a/cpukit/posix/src/ualarm.c
+++ b/cpukit/posix/src/ualarm.c
@@ -18,14 +18,14 @@
 #include "config.h"
 #endif
 
-#include <pthread.h>
-/* #include <errno.h> */
+#include <signal.h>
+#include <unistd.h>
 
-#include <rtems/system.h>
-#include <rtems/score/watchdogimpl.h>
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/psignalimpl.h>
 #include <rtems/posix/time.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/watchdogimpl.h>
 
 static void _POSIX_signals_Ualarm_TSR( Objects_Id id, void *argument );
 
diff --git a/cpukit/rtems/src/clocktick.c b/cpukit/rtems/src/clocktick.c
index a6e4ac3..1b1624f 100644
--- a/cpukit/rtems/src/clocktick.c
+++ b/cpukit/rtems/src/clocktick.c
@@ -20,7 +20,7 @@
 
 #include <rtems/rtems/clock.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/tod.h>
 #include <rtems/score/watchdogimpl.h>
 
diff --git a/cpukit/rtems/src/eventseize.c b/cpukit/rtems/src/eventseize.c
index 995aeb4..32eacd4 100644
--- a/cpukit/rtems/src/eventseize.c
+++ b/cpukit/rtems/src/eventseize.c
@@ -20,6 +20,7 @@
 
 #include <rtems/rtems/eventimpl.h>
 #include <rtems/rtems/optionsimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 /*
diff --git a/cpukit/rtems/src/eventsend.c b/cpukit/rtems/src/eventsend.c
index c7d874a..807bf79 100644
--- a/cpukit/rtems/src/eventsend.c
+++ b/cpukit/rtems/src/eventsend.c
@@ -20,6 +20,7 @@
 
 #include <rtems/rtems/eventimpl.h>
 #include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_event_send(
   rtems_id        id,
diff --git a/cpukit/rtems/src/eventsurrender.c b/cpukit/rtems/src/eventsurrender.c
index 10453fe..d3af8b8 100644
--- a/cpukit/rtems/src/eventsurrender.c
+++ b/cpukit/rtems/src/eventsurrender.c
@@ -20,6 +20,7 @@
 
 #include <rtems/rtems/eventimpl.h>
 #include <rtems/rtems/optionsimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Event_Surrender(
diff --git a/cpukit/rtems/src/eventtimeout.c b/cpukit/rtems/src/eventtimeout.c
index 4ec7fa0..24ae46e 100644
--- a/cpukit/rtems/src/eventtimeout.c
+++ b/cpukit/rtems/src/eventtimeout.c
@@ -19,6 +19,7 @@
 #endif
 
 #include <rtems/rtems/eventimpl.h>
+#include <rtems/score/threadimpl.h>
 
 void _Event_Timeout(
   Objects_Id  id,
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
index a2b49ea..d516251 100644
--- a/cpukit/rtems/src/msgmp.c
+++ b/cpukit/rtems/src/msgmp.c
@@ -28,6 +28,7 @@
 #include <rtems/score/thread.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/rtems/support.h>
+#include <rtems/score/threadimpl.h>
 
 RTEMS_STATIC_ASSERT(
   MESSAGE_QUEUE_MP_PACKET_SIZE <= MP_PACKET_MINIMUM_PACKET_SIZE,
diff --git a/cpukit/rtems/src/msgqtranslatereturncode.c b/cpukit/rtems/src/msgqtranslatereturncode.c
index a6f912b..aeedff7 100644
--- a/cpukit/rtems/src/msgqtranslatereturncode.c
+++ b/cpukit/rtems/src/msgqtranslatereturncode.c
@@ -24,7 +24,7 @@
 #include <rtems/score/coremsgimpl.h>
 #include <rtems/score/object.h>
 #include <rtems/score/states.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c
index d3b4f73..ea88026 100644
--- a/cpukit/rtems/src/partmp.c
+++ b/cpukit/rtems/src/partmp.c
@@ -27,6 +27,7 @@
 #include <rtems/rtems/partimpl.h>
 #include <rtems/score/thread.h>
 #include <rtems/rtems/support.h>
+#include <rtems/score/threadimpl.h>
 
 RTEMS_STATIC_ASSERT(
   sizeof(Partition_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
diff --git a/cpukit/rtems/src/ratemoncancel.c b/cpukit/rtems/src/ratemoncancel.c
index 8303afd..4a87fe0 100644
--- a/cpukit/rtems/src/ratemoncancel.c
+++ b/cpukit/rtems/src/ratemoncancel.c
@@ -20,7 +20,7 @@
 
 #include <rtems/rtems/ratemonimpl.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 rtems_status_code rtems_rate_monotonic_cancel(
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 078b06d..25e64b2 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -20,7 +20,7 @@
 
 #include <rtems/rtems/ratemonimpl.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/tod.h>
 #include <rtems/score/watchdogimpl.h>
 
diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/ratemontimeout.c
index 947fa2f..4f20595 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -18,13 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
 #include <rtems/rtems/ratemonimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Rate_monotonic_Timeout(
diff --git a/cpukit/rtems/src/regionmp.c b/cpukit/rtems/src/regionmp.c
index 6828fbb..f0dc4d8 100644
--- a/cpukit/rtems/src/regionmp.c
+++ b/cpukit/rtems/src/regionmp.c
@@ -27,6 +27,7 @@
 #include <rtems/rtems/regionimpl.h>
 #include <rtems/score/thread.h>
 #include <rtems/rtems/support.h>
+#include <rtems/score/threadimpl.h>
 
 RTEMS_STATIC_ASSERT(
   sizeof(Region_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
diff --git a/cpukit/rtems/src/signalmp.c b/cpukit/rtems/src/signalmp.c
index f70a452..29054cd 100644
--- a/cpukit/rtems/src/signalmp.c
+++ b/cpukit/rtems/src/signalmp.c
@@ -29,6 +29,7 @@
 #include <rtems/score/thread.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/rtems/support.h>
+#include <rtems/score/threadimpl.h>
 
 RTEMS_STATIC_ASSERT(
   sizeof(Signal_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
diff --git a/cpukit/rtems/src/signalsend.c b/cpukit/rtems/src/signalsend.c
index f8002e5..56f5416 100644
--- a/cpukit/rtems/src/signalsend.c
+++ b/cpukit/rtems/src/signalsend.c
@@ -18,15 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/asrimpl.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/asr.h>
-#include <rtems/score/isr.h>
-#include <rtems/rtems/modes.h>
 #include <rtems/rtems/signal.h>
-#include <rtems/score/thread.h>
+#include <rtems/rtems/asrimpl.h>
 #include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_signal_send(
   rtems_id          id,
diff --git a/cpukit/rtems/src/systemeventsend.c b/cpukit/rtems/src/systemeventsend.c
index 73aa2e1..129fa88 100644
--- a/cpukit/rtems/src/systemeventsend.c
+++ b/cpukit/rtems/src/systemeventsend.c
@@ -26,6 +26,7 @@
 
 #include <rtems/rtems/eventimpl.h>
 #include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_event_system_send(
   rtems_id        id,
diff --git a/cpukit/rtems/src/taskcreate.c b/cpukit/rtems/src/taskcreate.c
index d80e9ed..03ea10a 100644
--- a/cpukit/rtems/src/taskcreate.c
+++ b/cpukit/rtems/src/taskcreate.c
@@ -18,23 +18,13 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
+#include <rtems/rtems/tasksimpl.h>
 #include <rtems/rtems/attrimpl.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
 #include <rtems/rtems/modesimpl.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/sysstate.h>
+#include <rtems/rtems/support.h>
 #include <rtems/score/apimutex.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_task_create(
   rtems_name           name,
diff --git a/cpukit/rtems/src/taskdelete.c b/cpukit/rtems/src/taskdelete.c
index a43e222..82866f2 100644
--- a/cpukit/rtems/src/taskdelete.c
+++ b/cpukit/rtems/src/taskdelete.c
@@ -18,21 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
 #include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
 #include <rtems/score/apimutex.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/config.h>
 
 rtems_status_code rtems_task_delete(
   rtems_id id
diff --git a/cpukit/rtems/src/taskgetnote.c b/cpukit/rtems/src/taskgetnote.c
index 430e9a3..cd31d8a 100644
--- a/cpukit/rtems/src/taskgetnote.c
+++ b/cpukit/rtems/src/taskgetnote.c
@@ -18,20 +18,9 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
 #include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/config.h>
 
 rtems_status_code rtems_task_get_note(
   rtems_id    id,
diff --git a/cpukit/rtems/src/taskissuspended.c b/cpukit/rtems/src/taskissuspended.c
index ee47787..dd6a7a3 100644
--- a/cpukit/rtems/src/taskissuspended.c
+++ b/cpukit/rtems/src/taskissuspended.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 
 /*
  *  rtems_task_is_suspended
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c
index bcfdc50..bbe59bb 100644
--- a/cpukit/rtems/src/taskmode.c
+++ b/cpukit/rtems/src/taskmode.c
@@ -18,21 +18,11 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
+#include <rtems/rtems/tasks.h>
 #include <rtems/rtems/asrimpl.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
 #include <rtems/rtems/modesimpl.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/config.h>
 
 rtems_status_code rtems_task_mode(
   rtems_mode  mode_set,
diff --git a/cpukit/rtems/src/taskmp.c b/cpukit/rtems/src/taskmp.c
index 78738c2..2dec74a 100644
--- a/cpukit/rtems/src/taskmp.c
+++ b/cpukit/rtems/src/taskmp.c
@@ -28,6 +28,7 @@
 #include <rtems/score/thread.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/rtems/support.h>
+#include <rtems/score/threadimpl.h>
 
 RTEMS_STATIC_ASSERT(
   sizeof(RTEMS_tasks_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
diff --git a/cpukit/rtems/src/taskrestart.c b/cpukit/rtems/src/taskrestart.c
index 66f4604..10b159d 100644
--- a/cpukit/rtems/src/taskrestart.c
+++ b/cpukit/rtems/src/taskrestart.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_task_restart(
   rtems_id  id,
diff --git a/cpukit/rtems/src/taskresume.c b/cpukit/rtems/src/taskresume.c
index ee06dca..60af82e 100644
--- a/cpukit/rtems/src/taskresume.c
+++ b/cpukit/rtems/src/taskresume.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
 #include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_task_resume(
   rtems_id id
diff --git a/cpukit/rtems/src/tasksetnote.c b/cpukit/rtems/src/tasksetnote.c
index f79baaa..9aa8a08 100644
--- a/cpukit/rtems/src/tasksetnote.c
+++ b/cpukit/rtems/src/tasksetnote.c
@@ -18,20 +18,9 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
 #include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/config.h>
 
 rtems_status_code rtems_task_set_note(
   rtems_id id,
diff --git a/cpukit/rtems/src/tasksetpriority.c b/cpukit/rtems/src/tasksetpriority.c
index b522fd2..385990c 100644
--- a/cpukit/rtems/src/tasksetpriority.c
+++ b/cpukit/rtems/src/tasksetpriority.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
 #include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_task_set_priority(
   rtems_id             id,
diff --git a/cpukit/rtems/src/taskstart.c b/cpukit/rtems/src/taskstart.c
index ae4b707..a5dac15 100644
--- a/cpukit/rtems/src/taskstart.c
+++ b/cpukit/rtems/src/taskstart.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 
 /*
  *  rtems_task_start
diff --git a/cpukit/rtems/src/tasksuspend.c b/cpukit/rtems/src/tasksuspend.c
index a88e211..dced5d2 100644
--- a/cpukit/rtems/src/tasksuspend.c
+++ b/cpukit/rtems/src/tasksuspend.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
 #include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
 
 rtems_status_code rtems_task_suspend(
   rtems_id id
diff --git a/cpukit/rtems/src/taskvariable_invoke_dtor.c b/cpukit/rtems/src/taskvariable_invoke_dtor.c
index db13f09..3a22fb4 100644
--- a/cpukit/rtems/src/taskvariable_invoke_dtor.c
+++ b/cpukit/rtems/src/taskvariable_invoke_dtor.c
@@ -18,8 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/rtems/tasksimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
 
 void _RTEMS_Tasks_Invoke_task_variable_dtor(
diff --git a/cpukit/rtems/src/taskvariableadd.c b/cpukit/rtems/src/taskvariableadd.c
index a241a11..1636d98 100644
--- a/cpukit/rtems/src/taskvariableadd.c
+++ b/cpukit/rtems/src/taskvariableadd.c
@@ -18,10 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/rtems/tasksimpl.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/config.h>
 
 rtems_status_code rtems_task_variable_add(
   rtems_id tid,
diff --git a/cpukit/rtems/src/taskvariabledelete.c b/cpukit/rtems/src/taskvariabledelete.c
index df5fc62..687ffad 100644
--- a/cpukit/rtems/src/taskvariabledelete.c
+++ b/cpukit/rtems/src/taskvariabledelete.c
@@ -18,10 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
 #include <rtems/rtems/tasksimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/config.h>
 
 rtems_status_code rtems_task_variable_delete(
   rtems_id  tid,
diff --git a/cpukit/rtems/src/taskvariableget.c b/cpukit/rtems/src/taskvariableget.c
index ec6d3c6..14ad1d1 100644
--- a/cpukit/rtems/src/taskvariableget.c
+++ b/cpukit/rtems/src/taskvariableget.c
@@ -18,10 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
 #include <rtems/rtems/tasksimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/config.h>
 
 /*
  *  rtems_task_variable_get
diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c
index 59c4f07..eee5771 100644
--- a/cpukit/rtems/src/taskwakeafter.c
+++ b/cpukit/rtems/src/taskwakeafter.c
@@ -18,8 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c
index 31eb5d8..7bee637 100644
--- a/cpukit/rtems/src/taskwakewhen.c
+++ b/cpukit/rtems/src/taskwakewhen.c
@@ -18,20 +18,9 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
+#include <rtems/rtems/tasks.h>
 #include <rtems/rtems/clock.h>
-#include <rtems/score/object.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 rtems_status_code rtems_task_wake_when(
diff --git a/cpukit/rtems/src/timerserver.c b/cpukit/rtems/src/timerserver.c
index 9e66544..5c7099c 100644
--- a/cpukit/rtems/src/timerserver.c
+++ b/cpukit/rtems/src/timerserver.c
@@ -26,19 +26,12 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/score/object.h>
-#include <rtems/score/thread.h>
 #include <rtems/rtems/timerimpl.h>
+#include <rtems/rtems/tasksimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/tod.h>
 #include <rtems/score/watchdogimpl.h>
 
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/rtems/support.h>
-#include <rtems/score/thread.h>
-
 static Timer_server_Control _Timer_server_Default;
 
 static void _Timer_server_Stop_interval_system_watchdog(
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index 91eac2a..0c4e1b0 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -50,7 +50,7 @@
 #include <rtems/score/priority.h>
 #include <rtems/score/prioritybitmapimpl.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/tod.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/watchdogimpl.h>
diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c
index a54b1e6..7a96869 100644
--- a/cpukit/sapi/src/exshutdown.c
+++ b/cpukit/sapi/src/exshutdown.c
@@ -13,10 +13,9 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/init.h>
 #include <rtems/score/sysstate.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/interr.h>
 
 #if defined(RTEMS_SMP)
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 617b99c..5b33078 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -58,6 +58,7 @@ include_rtems_score_HEADERS += include/rtems/score/stackimpl.h
 include_rtems_score_HEADERS += include/rtems/score/states.h
 include_rtems_score_HEADERS += include/rtems/score/sysstate.h
 include_rtems_score_HEADERS += include/rtems/score/thread.h
+include_rtems_score_HEADERS += include/rtems/score/threadimpl.h
 include_rtems_score_HEADERS += include/rtems/score/threaddispatch.h
 include_rtems_score_HEADERS += include/rtems/score/threadq.h
 include_rtems_score_HEADERS += include/rtems/score/threadsync.h
@@ -100,7 +101,6 @@ endif
 ## inline
 include_rtems_score_HEADERS += inline/rtems/score/object.inl
 include_rtems_score_HEADERS += inline/rtems/score/states.inl
-include_rtems_score_HEADERS += inline/rtems/score/thread.inl
 include_rtems_score_HEADERS += inline/rtems/score/threadq.inl
 include_rtems_score_HEADERS += inline/rtems/score/tod.inl
 include_rtems_score_HEADERS += inline/rtems/score/tqdata.inl
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index af7c3fa..756cd96 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -21,7 +21,7 @@
 #include <rtems/score/coremutex.h>
 #include <rtems/score/chainimpl.h>
 #include <rtems/score/sysstate.h>
-#include <rtems/score/threaddispatch.h>
+#include <rtems/score/threadimpl.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 4300d1a..c07350b 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -19,6 +19,22 @@
 #ifndef _RTEMS_SCORE_THREAD_H
 #define _RTEMS_SCORE_THREAD_H
 
+#include <rtems/score/context.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/score/mppkt.h>
+#endif
+#include <rtems/score/object.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/stack.h>
+#include <rtems/score/states.h>
+#include <rtems/score/tqdata.h>
+#include <rtems/score/watchdog.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  *  @defgroup ScoreThread Thread Handler
  *
@@ -50,26 +66,6 @@
   #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <rtems/score/percpu.h>
-#include <rtems/score/context.h>
-#include <rtems/score/cpu.h>
-#include <rtems/score/isr.h>
-#if defined(RTEMS_MULTIPROCESSING)
-#include <rtems/score/mppkt.h>
-#endif
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/states.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/tqdata.h>
-#include <rtems/score/watchdog.h>
-
 /*
  *  The user can define this at configure time and go back to ticks
  *  resolution.
@@ -236,12 +232,6 @@ typedef struct {
 } Thread_Start_information;
 
 /**
- *  The following structure contains the information necessary to manage
- *  a thread which it is  waiting for a resource.
- */
-#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
-
-/**
  *  @brief Union type to hold a pointer to an immutable or a mutable object.
  *
  *  The main purpose is to enable passing of pointers to read-only send buffers
@@ -450,359 +440,6 @@ struct Thread_Control_struct {
   rtems_task_variable_t                *task_variables;
 };
 
-/**
- *  Self for the GNU Ada Run-Time
- */
-SCORE_EXTERN void *rtems_ada_self;
-
-/**
- *  The following defines the information control block used to
- *  manage this class of objects.
- */
-SCORE_EXTERN Objects_Information _Thread_Internal_information;
-
-/**
- *  The following context area contains the context of the "thread"
- *  which invoked the start multitasking routine.  This context is
- *  restored as the last action of the stop multitasking routine.  Thus
- *  control of the processor can be returned to the environment
- *  which initiated the system.
- */
-SCORE_EXTERN Context_Control _Thread_BSP_context;
-
-/**
- *  The following holds how many user extensions are in the system.  This
- *  is used to determine how many user extension data areas to allocate
- *  per thread.
- */
-SCORE_EXTERN uint32_t   _Thread_Maximum_extensions;
-
-/**
- *  The following is used to manage the length of a timeslice quantum.
- */
-SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
-
-/**
- *  The following points to the thread whose floating point
- *  context is currently loaded.
- */
-#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
-SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
-#endif
-
-#if !defined(__DYNAMIC_REENT__)
-/**
- * The C library re-enter-rant global pointer. Some C library implementations
- * such as newlib have a single global pointer that changed during a context
- * switch. The pointer points to that global pointer. The Thread control block
- * holds a pointer to the task specific data.
- */
-SCORE_EXTERN struct _reent **_Thread_libc_reent;
-#endif
-
-/**
- *  @brief Initialize thread handler.
- *
- *  This routine performs the initialization necessary for this handler.
- */
-void _Thread_Handler_initialization(void);
-
-/**
- *  @brief Create idle thread.
- *
- *  This routine creates the idle thread.
- *
- *  @warning No thread should be created before this one.
- */
-void _Thread_Create_idle(void);
-
-/**
- *  @brief Start thread multitasking.
- *
- *  This routine initiates multitasking.  It is invoked only as
- *  part of initialization and its invocation is the last act of
- *  the non-multitasking part of the system initialization.
- *
- *
- *  - INTERRUPT LATENCY:
- *    + ready chain
- *    + select heir
- */
-void _Thread_Start_multitasking( void );
-
-/**
- *  @brief Allocate the requested stack space for the thread.
- *
- *  Allocate the requested stack space for the thread.
- *  Set the Start.stack field to the address of the stack.
- *
- *  @param[in] the_thread is the thread where the stack space is requested
- *
- *  @retval actual size allocated after any adjustment
- *  @retval zero if the allocation failed
- */
-size_t _Thread_Stack_Allocate(
-  Thread_Control *the_thread,
-  size_t          stack_size
-);
-
-/**
- *  @brief Deallocate thread stack.
- *
- *  Deallocate the Thread's stack.
- */
-void _Thread_Stack_Free(
-  Thread_Control *the_thread
-);
-
-/**
- *  @brief Initialize thread.
- *
- *  This routine initializes the specified the thread.  It allocates
- *  all memory associated with this thread.  It completes by adding
- *  the thread to the local object table so operations on this
- *  thread id are allowed.
- *
- *  @note If stack_area is NULL, it is allocated from the workspace.
- *
- *  @note If the stack is allocated from the workspace, then it is
- *        guaranteed to be of at least minimum size.
- */
-bool _Thread_Initialize(
-  Objects_Information                  *information,
-  Thread_Control                       *the_thread,
-  void                                 *stack_area,
-  size_t                                stack_size,
-  bool                                  is_fp,
-  Priority_Control                      priority,
-  bool                                  is_preemptible,
-  Thread_CPU_budget_algorithms          budget_algorithm,
-  Thread_CPU_budget_algorithm_callout   budget_callout,
-  uint32_t                              isr_level,
-  Objects_Name                          name
-);
-
-/**
- *  @brief Initializes thread and executes it.
- *
- *  This routine initializes the executable information for a thread
- *  and makes it ready to execute.  After this routine executes, the
- *  thread competes with all other threads for CPU time.
- *
- *  @param the_thread is the thread to be initialized
- *  @param the_prototype
- *  @param entry_point
- *  @param pointer_argument
- *  @param numeric_argument
- *  @param[in,out] processor The processor if used to start an idle thread
- *  during system initialization.  Must be set to @c NULL to start a normal
- *  thread.
- */
-bool _Thread_Start(
-  Thread_Control            *the_thread,
-  Thread_Start_types         the_prototype,
-  void                      *entry_point,
-  void                      *pointer_argument,
-  Thread_Entry_numeric_type  numeric_argument,
-  Per_CPU_Control           *processor
-);
-
-/**
- *  @brief Restarts the specified thread.
- *
- *  This support routine restarts the specified task in a way that the
- *  next time this thread executes, it will begin execution at its
- *  original starting point.
- *
- *  TODO:  multiple task arg profiles
- */
-bool _Thread_Restart(
-  Thread_Control            *the_thread,
-  void                      *pointer_argument,
-  Thread_Entry_numeric_type  numeric_argument
-);
-
-/**
- *  @brief Resets a thread to its initial state.
- *
- *  This routine resets a thread to its initial state but does
- *  not restart it. Some APIs do this in separate
- *  operations and this division helps support this.
- *
- *  @param[in] the_thread is the thread to resets
- *  @param[in] pointer_argument
- *  @param[in] numeric_argument
- */
-void _Thread_Reset(
-  Thread_Control            *the_thread,
-  void                      *pointer_argument,
-  Thread_Entry_numeric_type  numeric_argument
-);
-
-/**
- *  @brief Frees all memory associated with the specified thread.
- *
- *  This routine frees all memory associated with the specified
- *  thread and removes it from the local object table so no further
- *  operations on this thread are allowed.
- */
-void _Thread_Close(
-  Objects_Information  *information,
-  Thread_Control       *the_thread
-);
-
-/**
- *  @brief Removes any set states for @a the_thread.
- *
- *  This routine removes any set states for @a the_thread.  It performs
- *  any necessary scheduling operations including the selection of
- *  a new heir thread.
- *
- *  - INTERRUPT LATENCY:
- *    + ready chain
- *    + select heir
- */
-void _Thread_Ready(
-  Thread_Control *the_thread
-);
-
-/**
- *  @brief Clears the indicated STATES for @a the_thread.
- *
- *  This routine clears the indicated STATES for @a the_thread.  It performs
- *  any necessary scheduling operations including the selection of
- *  a new heir thread.
- *
- *  - INTERRUPT LATENCY:
- *    + priority map
- *    + select heir
- */
-void _Thread_Clear_state(
-  Thread_Control *the_thread,
-  States_Control  state
-);
-
-/**
- *  @brief Sets the indicated @a state for @a the_thread.
- *
- *  This routine sets the indicated @a state for @a the_thread.  It performs
- *  any necessary scheduling operations including the selection of
- *  a new heir thread.
- *
- *  @param[in] the_thread is the thread to set the state for.
- *  @param[in] state is the state to set the_thread to.
- *
- *  - INTERRUPT LATENCY:
- *   + ready chain
- *   + select map
- */
-void _Thread_Set_state(
-  Thread_Control *the_thread,
-  States_Control  state
-);
-
-/**
- *  @brief Sets the transient state for a thread.
- *
- *  This routine sets the Transient state for @a the_thread.  It performs
- *  any necessary scheduling operations including the selection of
- *  a new heir thread.
- *
- *  @param[in] the_thread is the thread to preform the action upon.
- *
- *  - INTERRUPT LATENCY:
- *    + single case
- */
-void _Thread_Set_transient(
-  Thread_Control *the_thread
-);
-
-/**
- *  @brief Initializes enviroment for a thread.
- *
- *  This routine initializes the context of @a the_thread to its
- *  appropriate starting state.
- *
- *  @param[in] the_thread is the pointer to the thread control block.
- */
-void _Thread_Load_environment(
-  Thread_Control *the_thread
-);
-
-/**
- *  @brief Wrapper function for all threads.
- *
- *  This routine is the wrapper function for all threads.  It is
- *  the starting point for all threads.  The user provided thread
- *  entry point is invoked by this routine.  Operations
- *  which must be performed immediately before and after the user's
- *  thread executes are found here.
- *
- *  @note On entry, it is assumed all interrupts are blocked and that this
- *  routine needs to set the initial isr level.  This may or may not
- *  actually be needed by the context switch routine and as a result
- *  interrupts may already be at there proper level.  Either way,
- *  setting the initial isr level properly here is safe.
- */
-void _Thread_Handler( void );
-
-/**
- *  @brief Ended the delay of a thread.
- *
- *  This routine is invoked when a thread must be unblocked at the
- *  end of a time based delay (i.e. wake after or wake when).
- *  It is called by the watchdog handler.
- *
- *  @param[in] id is the thread id
- */
-void _Thread_Delay_ended(
-  Objects_Id  id,
-  void       *ignored
-);
-
-/**
- *  @brief Change the priority of a thread.
- *
- *  This routine changes the current priority of @a the_thread to
- *  @a new_priority.  It performs any necessary scheduling operations
- *  including the selection of a new heir thread.
- *
- *  @param[in] the_thread is the thread to change
- *  @param[in] new_priority is the priority to set @a the_thread to
- *  @param[in] prepend_it is a switch to prepend the thread
- */
-void _Thread_Change_priority (
-  Thread_Control   *the_thread,
-  Priority_Control  new_priority,
-  bool              prepend_it
-);
-
-/**
- *  @brief Set thread priority.
- *
- *  This routine updates the priority related fields in the_thread
- *  control block to indicate the current priority is now new_priority.
- */
-void _Thread_Set_priority(
-  Thread_Control   *the_thread,
-  Priority_Control  new_priority
-);
-
-/**
- *  This routine updates the related suspend fields in the_thread
- *  control block to indicate the current nested level.
- */
-#define _Thread_Suspend( _the_thread ) \
-        _Thread_Set_state( _the_thread, STATES_SUSPENDED )
-
-/**
- *  This routine updates the related suspend fields in the_thread
- *  control block to indicate the current nested level.  A force
- *  parameter of true will force a resume and clear the suspend count.
- */
-#define _Thread_Resume( _the_thread ) \
-        _Thread_Clear_state( _the_thread, STATES_SUSPENDED )
-
 #if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
 /**
  *  This routine is the body of the system idle thread.
@@ -828,56 +465,6 @@ void rtems_iterate_over_all_threads(
 );
 
 /**
- *  @brief Maps thread Id to a TCB pointer.
- *
- *  This function maps thread IDs to thread control
- *  blocks.  If ID corresponds to a local thread, then it
- *  returns the_thread control pointer which maps to ID
- *  and @a location is set to OBJECTS_LOCAL.  If the thread ID is
- *  global and resides on a remote node, then location is set
- *  to OBJECTS_REMOTE, and the_thread is undefined.
- *  Otherwise, location is set to OBJECTS_ERROR and
- *  the_thread is undefined.
- *
- *  @param[in] id is the id of the thread.
- *  @param[in] location is the location of the block.
- *
- *  @note  The performance of many RTEMS services depends upon
- *         the quick execution of the "good object" path in this
- *         routine.  If there is a possibility of saving a few
- *         cycles off the execution time, this routine is worth
- *         further optimization attention.
- */
-Thread_Control *_Thread_Get (
-  Objects_Id         id,
-  Objects_Locations *location
-);
-
-/**
- *  @brief Cancel a blocking operation due to ISR.
- *
- *  This method is used to cancel a blocking operation that was
- *  satisfied from an ISR while the thread executing was in the
- *  process of blocking.
- *
- *  This method will restore the previous ISR disable level during the cancel
- *  operation.  Thus it is an implicit _ISR_Enable().
- *
- *  @param[in] sync_state is the synchronization state
- *  @param[in] the_thread is the thread whose blocking is canceled
- *  @param[in] level is the previous ISR disable level
- *
- *  @note This is a rare routine in RTEMS.  It is called with
- *        interrupts disabled and only when an ISR completed
- *        a blocking condition in process.
- */
-void _Thread_blocking_operation_Cancel(
-  Thread_blocking_operation_States  sync_state,
-  Thread_Control                   *the_thread,
-  ISR_Level                         level
-);
-
-/**
  * @brief Returns the thread control block of the executing thread.
  *
  * This function can be called in any context.  On SMP configurations
@@ -905,18 +492,11 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_executing( void )
   return executing;
 }
 
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/score/thread.inl>
-#endif
-#if defined(RTEMS_MULTIPROCESSING)
-#include <rtems/score/threadmp.h>
-#endif
+/**@}*/
 
 #ifdef __cplusplus
 }
 #endif
 
-/**@}*/
-
 #endif
 /* end of include file */
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
new file mode 100644
index 0000000..205c704
--- /dev/null
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -0,0 +1,691 @@
+/**
+ * @file
+ *
+ * @brief Inlined Routines from the Thread Handler
+ *
+ * This file contains the macro implementation of the inlined
+ * routines from the Thread handler.
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2008.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_THREADIMPL_H
+#define _RTEMS_SCORE_THREADIMPL_H
+
+#include <rtems/score/thread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ScoreThread
+ */
+/**@{**/
+
+/**
+ *  The following structure contains the information necessary to manage
+ *  a thread which it is  waiting for a resource.
+ */
+#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
+
+/**
+ *  Self for the GNU Ada Run-Time
+ */
+SCORE_EXTERN void *rtems_ada_self;
+
+/**
+ *  The following defines the information control block used to
+ *  manage this class of objects.
+ */
+SCORE_EXTERN Objects_Information _Thread_Internal_information;
+
+/**
+ *  The following context area contains the context of the "thread"
+ *  which invoked the start multitasking routine.  This context is
+ *  restored as the last action of the stop multitasking routine.  Thus
+ *  control of the processor can be returned to the environment
+ *  which initiated the system.
+ */
+SCORE_EXTERN Context_Control _Thread_BSP_context;
+
+/**
+ *  The following holds how many user extensions are in the system.  This
+ *  is used to determine how many user extension data areas to allocate
+ *  per thread.
+ */
+SCORE_EXTERN uint32_t   _Thread_Maximum_extensions;
+
+/**
+ *  The following is used to manage the length of a timeslice quantum.
+ */
+SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
+
+/**
+ *  The following points to the thread whose floating point
+ *  context is currently loaded.
+ */
+#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
+SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
+#endif
+
+#if !defined(__DYNAMIC_REENT__)
+/**
+ * The C library re-enter-rant global pointer. Some C library implementations
+ * such as newlib have a single global pointer that changed during a context
+ * switch. The pointer points to that global pointer. The Thread control block
+ * holds a pointer to the task specific data.
+ */
+SCORE_EXTERN struct _reent **_Thread_libc_reent;
+#endif
+
+/**
+ *  @brief Initialize thread handler.
+ *
+ *  This routine performs the initialization necessary for this handler.
+ */
+void _Thread_Handler_initialization(void);
+
+/**
+ *  @brief Create idle thread.
+ *
+ *  This routine creates the idle thread.
+ *
+ *  @warning No thread should be created before this one.
+ */
+void _Thread_Create_idle(void);
+
+/**
+ *  @brief Start thread multitasking.
+ *
+ *  This routine initiates multitasking.  It is invoked only as
+ *  part of initialization and its invocation is the last act of
+ *  the non-multitasking part of the system initialization.
+ *
+ *
+ *  - INTERRUPT LATENCY:
+ *    + ready chain
+ *    + select heir
+ */
+void _Thread_Start_multitasking( void );
+
+/**
+ *  @brief Allocate the requested stack space for the thread.
+ *
+ *  Allocate the requested stack space for the thread.
+ *  Set the Start.stack field to the address of the stack.
+ *
+ *  @param[in] the_thread is the thread where the stack space is requested
+ *
+ *  @retval actual size allocated after any adjustment
+ *  @retval zero if the allocation failed
+ */
+size_t _Thread_Stack_Allocate(
+  Thread_Control *the_thread,
+  size_t          stack_size
+);
+
+/**
+ *  @brief Deallocate thread stack.
+ *
+ *  Deallocate the Thread's stack.
+ */
+void _Thread_Stack_Free(
+  Thread_Control *the_thread
+);
+
+/**
+ *  @brief Initialize thread.
+ *
+ *  This routine initializes the specified the thread.  It allocates
+ *  all memory associated with this thread.  It completes by adding
+ *  the thread to the local object table so operations on this
+ *  thread id are allowed.
+ *
+ *  @note If stack_area is NULL, it is allocated from the workspace.
+ *
+ *  @note If the stack is allocated from the workspace, then it is
+ *        guaranteed to be of at least minimum size.
+ */
+bool _Thread_Initialize(
+  Objects_Information                  *information,
+  Thread_Control                       *the_thread,
+  void                                 *stack_area,
+  size_t                                stack_size,
+  bool                                  is_fp,
+  Priority_Control                      priority,
+  bool                                  is_preemptible,
+  Thread_CPU_budget_algorithms          budget_algorithm,
+  Thread_CPU_budget_algorithm_callout   budget_callout,
+  uint32_t                              isr_level,
+  Objects_Name                          name
+);
+
+/**
+ *  @brief Initializes thread and executes it.
+ *
+ *  This routine initializes the executable information for a thread
+ *  and makes it ready to execute.  After this routine executes, the
+ *  thread competes with all other threads for CPU time.
+ *
+ *  @param the_thread is the thread to be initialized
+ *  @param the_prototype
+ *  @param entry_point
+ *  @param pointer_argument
+ *  @param numeric_argument
+ *  @param[in,out] processor The processor if used to start an idle thread
+ *  during system initialization.  Must be set to @c NULL to start a normal
+ *  thread.
+ */
+bool _Thread_Start(
+  Thread_Control            *the_thread,
+  Thread_Start_types         the_prototype,
+  void                      *entry_point,
+  void                      *pointer_argument,
+  Thread_Entry_numeric_type  numeric_argument,
+  Per_CPU_Control           *processor
+);
+
+/**
+ *  @brief Restarts the specified thread.
+ *
+ *  This support routine restarts the specified task in a way that the
+ *  next time this thread executes, it will begin execution at its
+ *  original starting point.
+ *
+ *  TODO:  multiple task arg profiles
+ */
+bool _Thread_Restart(
+  Thread_Control            *the_thread,
+  void                      *pointer_argument,
+  Thread_Entry_numeric_type  numeric_argument
+);
+
+/**
+ *  @brief Resets a thread to its initial state.
+ *
+ *  This routine resets a thread to its initial state but does
+ *  not restart it. Some APIs do this in separate
+ *  operations and this division helps support this.
+ *
+ *  @param[in] the_thread is the thread to resets
+ *  @param[in] pointer_argument
+ *  @param[in] numeric_argument
+ */
+void _Thread_Reset(
+  Thread_Control            *the_thread,
+  void                      *pointer_argument,
+  Thread_Entry_numeric_type  numeric_argument
+);
+
+/**
+ *  @brief Frees all memory associated with the specified thread.
+ *
+ *  This routine frees all memory associated with the specified
+ *  thread and removes it from the local object table so no further
+ *  operations on this thread are allowed.
+ */
+void _Thread_Close(
+  Objects_Information  *information,
+  Thread_Control       *the_thread
+);
+
+/**
+ *  @brief Removes any set states for @a the_thread.
+ *
+ *  This routine removes any set states for @a the_thread.  It performs
+ *  any necessary scheduling operations including the selection of
+ *  a new heir thread.
+ *
+ *  - INTERRUPT LATENCY:
+ *    + ready chain
+ *    + select heir
+ */
+void _Thread_Ready(
+  Thread_Control *the_thread
+);
+
+/**
+ *  @brief Clears the indicated STATES for @a the_thread.
+ *
+ *  This routine clears the indicated STATES for @a the_thread.  It performs
+ *  any necessary scheduling operations including the selection of
+ *  a new heir thread.
+ *
+ *  - INTERRUPT LATENCY:
+ *    + priority map
+ *    + select heir
+ */
+void _Thread_Clear_state(
+  Thread_Control *the_thread,
+  States_Control  state
+);
+
+/**
+ *  @brief Sets the indicated @a state for @a the_thread.
+ *
+ *  This routine sets the indicated @a state for @a the_thread.  It performs
+ *  any necessary scheduling operations including the selection of
+ *  a new heir thread.
+ *
+ *  @param[in] the_thread is the thread to set the state for.
+ *  @param[in] state is the state to set the_thread to.
+ *
+ *  - INTERRUPT LATENCY:
+ *   + ready chain
+ *   + select map
+ */
+void _Thread_Set_state(
+  Thread_Control *the_thread,
+  States_Control  state
+);
+
+/**
+ *  @brief Sets the transient state for a thread.
+ *
+ *  This routine sets the Transient state for @a the_thread.  It performs
+ *  any necessary scheduling operations including the selection of
+ *  a new heir thread.
+ *
+ *  @param[in] the_thread is the thread to preform the action upon.
+ *
+ *  - INTERRUPT LATENCY:
+ *    + single case
+ */
+void _Thread_Set_transient(
+  Thread_Control *the_thread
+);
+
+/**
+ *  @brief Initializes enviroment for a thread.
+ *
+ *  This routine initializes the context of @a the_thread to its
+ *  appropriate starting state.
+ *
+ *  @param[in] the_thread is the pointer to the thread control block.
+ */
+void _Thread_Load_environment(
+  Thread_Control *the_thread
+);
+
+/**
+ *  @brief Wrapper function for all threads.
+ *
+ *  This routine is the wrapper function for all threads.  It is
+ *  the starting point for all threads.  The user provided thread
+ *  entry point is invoked by this routine.  Operations
+ *  which must be performed immediately before and after the user's
+ *  thread executes are found here.
+ *
+ *  @note On entry, it is assumed all interrupts are blocked and that this
+ *  routine needs to set the initial isr level.  This may or may not
+ *  actually be needed by the context switch routine and as a result
+ *  interrupts may already be at there proper level.  Either way,
+ *  setting the initial isr level properly here is safe.
+ */
+void _Thread_Handler( void );
+
+/**
+ *  @brief Ended the delay of a thread.
+ *
+ *  This routine is invoked when a thread must be unblocked at the
+ *  end of a time based delay (i.e. wake after or wake when).
+ *  It is called by the watchdog handler.
+ *
+ *  @param[in] id is the thread id
+ */
+void _Thread_Delay_ended(
+  Objects_Id  id,
+  void       *ignored
+);
+
+/**
+ *  @brief Change the priority of a thread.
+ *
+ *  This routine changes the current priority of @a the_thread to
+ *  @a new_priority.  It performs any necessary scheduling operations
+ *  including the selection of a new heir thread.
+ *
+ *  @param[in] the_thread is the thread to change
+ *  @param[in] new_priority is the priority to set @a the_thread to
+ *  @param[in] prepend_it is a switch to prepend the thread
+ */
+void _Thread_Change_priority (
+  Thread_Control   *the_thread,
+  Priority_Control  new_priority,
+  bool              prepend_it
+);
+
+/**
+ *  @brief Set thread priority.
+ *
+ *  This routine updates the priority related fields in the_thread
+ *  control block to indicate the current priority is now new_priority.
+ */
+void _Thread_Set_priority(
+  Thread_Control   *the_thread,
+  Priority_Control  new_priority
+);
+
+/**
+ *  This routine updates the related suspend fields in the_thread
+ *  control block to indicate the current nested level.
+ */
+#define _Thread_Suspend( _the_thread ) \
+        _Thread_Set_state( _the_thread, STATES_SUSPENDED )
+
+/**
+ *  This routine updates the related suspend fields in the_thread
+ *  control block to indicate the current nested level.  A force
+ *  parameter of true will force a resume and clear the suspend count.
+ */
+#define _Thread_Resume( _the_thread ) \
+        _Thread_Clear_state( _the_thread, STATES_SUSPENDED )
+
+/**
+ *  @brief Maps thread Id to a TCB pointer.
+ *
+ *  This function maps thread IDs to thread control
+ *  blocks.  If ID corresponds to a local thread, then it
+ *  returns the_thread control pointer which maps to ID
+ *  and @a location is set to OBJECTS_LOCAL.  If the thread ID is
+ *  global and resides on a remote node, then location is set
+ *  to OBJECTS_REMOTE, and the_thread is undefined.
+ *  Otherwise, location is set to OBJECTS_ERROR and
+ *  the_thread is undefined.
+ *
+ *  @param[in] id is the id of the thread.
+ *  @param[in] location is the location of the block.
+ *
+ *  @note  The performance of many RTEMS services depends upon
+ *         the quick execution of the "good object" path in this
+ *         routine.  If there is a possibility of saving a few
+ *         cycles off the execution time, this routine is worth
+ *         further optimization attention.
+ */
+Thread_Control *_Thread_Get (
+  Objects_Id         id,
+  Objects_Locations *location
+);
+
+/**
+ *  @brief Cancel a blocking operation due to ISR.
+ *
+ *  This method is used to cancel a blocking operation that was
+ *  satisfied from an ISR while the thread executing was in the
+ *  process of blocking.
+ *
+ *  This method will restore the previous ISR disable level during the cancel
+ *  operation.  Thus it is an implicit _ISR_Enable().
+ *
+ *  @param[in] sync_state is the synchronization state
+ *  @param[in] the_thread is the thread whose blocking is canceled
+ *  @param[in] level is the previous ISR disable level
+ *
+ *  @note This is a rare routine in RTEMS.  It is called with
+ *        interrupts disabled and only when an ISR completed
+ *        a blocking condition in process.
+ */
+void _Thread_blocking_operation_Cancel(
+  Thread_blocking_operation_States  sync_state,
+  Thread_Control                   *the_thread,
+  ISR_Level                         level
+);
+
+/**
+ * This routine halts multitasking and returns control to
+ * the "thread" (i.e. the BSP) which initially invoked the
+ * routine which initialized the system.
+ */
+
+RTEMS_INLINE_ROUTINE void _Thread_Stop_multitasking( void )
+{
+#if defined(_CPU_Stop_multitasking)
+  _CPU_Stop_multitasking( &_Thread_BSP_context );
+#else
+  /*
+   *  This may look a bit of an odd but _Context_Restart_self is just
+   *  a very careful restore of a specific context which ensures that
+   *  if we were running within the same context, it would work.
+   *
+   *  And we will not return to this thread, so there is no point of
+   *  saving the context.
+   */
+  _Context_Restart_self( &_Thread_BSP_context );
+#endif
+
+  /***************************************************************
+   ***************************************************************
+   *   SYSTEM SHUTS DOWN!!!  WE DO NOT RETURN TO THIS POINT!!!   *
+   ***************************************************************
+   ***************************************************************
+   */
+}
+
+/**
+ * This function returns true if the_thread is the currently executing
+ * thread, and false otherwise.
+ */
+
+RTEMS_INLINE_ROUTINE bool _Thread_Is_executing (
+  const Thread_Control *the_thread
+)
+{
+  return ( the_thread == _Thread_Executing );
+}
+
+/**
+ * This function returns true if the_thread is the heir
+ * thread, and false otherwise.
+ */
+
+RTEMS_INLINE_ROUTINE bool _Thread_Is_heir (
+  const Thread_Control *the_thread
+)
+{
+  return ( the_thread == _Thread_Heir );
+}
+
+/**
+ * This function returns true if the currently executing thread
+ * is also the heir thread, and false otherwise.
+ */
+
+RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_also_the_heir( void )
+{
+  return ( _Thread_Executing == _Thread_Heir );
+}
+
+/**
+ * This routine clears any blocking state for the_thread.  It performs
+ * any necessary scheduling operations including the selection of
+ * a new heir thread.
+ */
+
+RTEMS_INLINE_ROUTINE void _Thread_Unblock (
+  Thread_Control *the_thread
+)
+{
+  _Thread_Clear_state( the_thread, STATES_BLOCKED );
+}
+
+/**
+ * This routine resets the current context of the calling thread
+ * to that of its initial state.
+ */
+
+RTEMS_INLINE_ROUTINE void _Thread_Restart_self( void )
+{
+#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
+  if ( _Thread_Executing->fp_context != NULL )
+    _Context_Restore_fp( &_Thread_Executing->fp_context );
+#endif
+
+  _CPU_Context_Restart_self( &_Thread_Executing->Registers );
+}
+
+/**
+ * This function returns true if the floating point context of
+ * the_thread is currently loaded in the floating point unit, and
+ * false otherwise.
+ */
+
+#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
+RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp (
+  const Thread_Control *the_thread
+)
+{
+  return ( the_thread == _Thread_Allocated_fp );
+}
+#endif
+
+/**
+ * This routine is invoked when the currently loaded floating
+ * point context is now longer associated with an active thread.
+ */
+
+#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
+RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
+{
+  _Thread_Allocated_fp = NULL;
+}
+#endif
+
+/**
+ * This function returns true if dispatching is disabled, and false
+ * otherwise.
+ */
+
+RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary( void )
+{
+  return ( _Thread_Dispatch_necessary );
+}
+
+/**
+ * This function returns true if the_thread is NULL and false otherwise.
+ */
+
+RTEMS_INLINE_ROUTINE bool _Thread_Is_null (
+  const Thread_Control *the_thread
+)
+{
+  return ( the_thread == NULL );
+}
+
+/**
+ * @brief Is proxy blocking.
+ *
+ * status which indicates that a proxy is blocking, and false otherwise.
+ */
+RTEMS_INLINE_ROUTINE bool _Thread_Is_proxy_blocking (
+  uint32_t   code
+)
+{
+  return (code == THREAD_STATUS_PROXY_BLOCKING);
+}
+
+/**
+ * This routine allocates an internal thread.
+ */
+
+RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void )
+{
+  return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information );
+}
+
+/**
+ * This routine frees an internal thread.
+ */
+
+RTEMS_INLINE_ROUTINE void _Thread_Internal_free (
+  Thread_Control *the_task
+)
+{
+  _Objects_Free( &_Thread_Internal_information, &the_task->Object );
+}
+
+RTEMS_INLINE_ROUTINE void _Thread_Set_global_exit_status(
+  uint32_t exit_status
+)
+{
+  Thread_Control *idle = (Thread_Control *)
+    _Thread_Internal_information.local_table[ 1 ];
+
+  idle->Wait.return_code = exit_status;
+}
+
+RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_global_exit_status( void )
+{
+  const Thread_Control *idle = (const Thread_Control *)
+    _Thread_Internal_information.local_table[ 1 ];
+
+  return idle->Wait.return_code;
+}
+
+/**
+ * @brief Issues a thread dispatch if necessary.
+ *
+ * @param[in] executing The executing thread.
+ * @param[in] needs_asr_dispatching Indicates whether or not the API
+ *            level signals are pending and a dispatch is necessary.
+ */
+RTEMS_INLINE_ROUTINE void _Thread_Dispatch_if_necessary(
+  Thread_Control *executing,
+  bool            needs_asr_dispatching
+)
+{
+  if ( _Thread_Dispatch_is_enabled() ) {
+    bool dispatch_necessary = needs_asr_dispatching;
+
+    if ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) {
+      dispatch_necessary = true;
+      _Thread_Dispatch_necessary = dispatch_necessary;
+    }
+
+    if ( dispatch_necessary ) {
+      _Thread_Dispatch();
+    }
+  }
+}
+
+#if !defined(__DYNAMIC_REENT__)
+/**
+ * This routine returns the C library re-enterant pointer.
+ */
+
+RTEMS_INLINE_ROUTINE struct _reent **_Thread_Get_libc_reent( void )
+{
+  return _Thread_libc_reent;
+}
+
+/**
+ * This routine set the C library re-enterant pointer.
+ */
+
+RTEMS_INLINE_ROUTINE void _Thread_Set_libc_reent (
+  struct _reent **libc_reent
+)
+{
+  _Thread_libc_reent = libc_reent;
+}
+#endif
+
+/** @}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/score/threadmp.h>
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/threadmp.h b/cpukit/score/include/rtems/score/threadmp.h
index 6c9788f..555bca2 100644
--- a/cpukit/score/include/rtems/score/threadmp.h
+++ b/cpukit/score/include/rtems/score/threadmp.h
@@ -19,6 +19,10 @@
 #ifndef _RTEMS_SCORE_THREADMP_H
 #define _RTEMS_SCORE_THREADMP_H
 
+#ifndef _RTEMS_SCORE_THREADIMPL_H
+# error "Never use <rtems/score/threadmp.h> directly; include <rtems/score/threadimpl.h> instead."
+#endif
+
 /**
  *  @defgroup ScoreThreadMP Thread Handler Multiprocessing Support
  *
diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl
deleted file mode 100644
index 9c0aecb..0000000
--- a/cpukit/score/inline/rtems/score/thread.inl
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- *
- * @brief Inlined Routines from the Thread Handler
- *
- * This file contains the macro implementation of the inlined
- * routines from the Thread handler.
- */
-
-/*
- *  COPYRIGHT (c) 1989-2008.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.com/license/LICENSE.
- */
-
-#ifndef _RTEMS_SCORE_THREAD_H
-# error "Never use <rtems/score/thread.inl> directly; include <rtems/score/thread.h> instead."
-#endif
-
-#ifndef _RTEMS_SCORE_THREAD_INL
-#define _RTEMS_SCORE_THREAD_INL
-
-#include <rtems/score/context.h>
-
-/**
- * @addtogroup ScoreThread
- */
-/**@{**/
-
-
-/**
- * This routine halts multitasking and returns control to
- * the "thread" (i.e. the BSP) which initially invoked the
- * routine which initialized the system.
- */
-
-RTEMS_INLINE_ROUTINE void _Thread_Stop_multitasking( void )
-{
-#if defined(_CPU_Stop_multitasking)
-  _CPU_Stop_multitasking( &_Thread_BSP_context );
-#else
-  /*
-   *  This may look a bit of an odd but _Context_Restart_self is just
-   *  a very careful restore of a specific context which ensures that
-   *  if we were running within the same context, it would work.
-   *
-   *  And we will not return to this thread, so there is no point of
-   *  saving the context.
-   */
-  _Context_Restart_self( &_Thread_BSP_context );
-#endif
-
-  /***************************************************************
-   ***************************************************************
-   *   SYSTEM SHUTS DOWN!!!  WE DO NOT RETURN TO THIS POINT!!!   *
-   ***************************************************************
-   ***************************************************************
-   */
-}
-
-/**
- * This function returns true if the_thread is the currently executing
- * thread, and false otherwise.
- */
-
-RTEMS_INLINE_ROUTINE bool _Thread_Is_executing (
-  const Thread_Control *the_thread
-)
-{
-  return ( the_thread == _Thread_Executing );
-}
-
-/**
- * This function returns true if the_thread is the heir
- * thread, and false otherwise.
- */
-
-RTEMS_INLINE_ROUTINE bool _Thread_Is_heir (
-  const Thread_Control *the_thread
-)
-{
-  return ( the_thread == _Thread_Heir );
-}
-
-/**
- * This function returns true if the currently executing thread
- * is also the heir thread, and false otherwise.
- */
-
-RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_also_the_heir( void )
-{
-  return ( _Thread_Executing == _Thread_Heir );
-}
-
-/**
- * This routine clears any blocking state for the_thread.  It performs
- * any necessary scheduling operations including the selection of
- * a new heir thread.
- */
-
-RTEMS_INLINE_ROUTINE void _Thread_Unblock (
-  Thread_Control *the_thread
-)
-{
-  _Thread_Clear_state( the_thread, STATES_BLOCKED );
-}
-
-/**
- * This routine resets the current context of the calling thread
- * to that of its initial state.
- */
-
-RTEMS_INLINE_ROUTINE void _Thread_Restart_self( void )
-{
-#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
-  if ( _Thread_Executing->fp_context != NULL )
-    _Context_Restore_fp( &_Thread_Executing->fp_context );
-#endif
-
-  _CPU_Context_Restart_self( &_Thread_Executing->Registers );
-}
-
-/**
- * This function returns true if the floating point context of
- * the_thread is currently loaded in the floating point unit, and
- * false otherwise.
- */
-
-#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
-RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp (
-  const Thread_Control *the_thread
-)
-{
-  return ( the_thread == _Thread_Allocated_fp );
-}
-#endif
-
-/**
- * This routine is invoked when the currently loaded floating
- * point context is now longer associated with an active thread.
- */
-
-#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
-RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
-{
-  _Thread_Allocated_fp = NULL;
-}
-#endif
-
-/**
- * This function returns true if dispatching is disabled, and false
- * otherwise.
- */
-
-RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary( void )
-{
-  return ( _Thread_Dispatch_necessary );
-}
-
-/**
- * This function returns true if the_thread is NULL and false otherwise.
- */
-
-RTEMS_INLINE_ROUTINE bool _Thread_Is_null (
-  const Thread_Control *the_thread
-)
-{
-  return ( the_thread == NULL );
-}
-
-/**
- * @brief Is proxy blocking.
- *
- * status which indicates that a proxy is blocking, and false otherwise.
- */
-RTEMS_INLINE_ROUTINE bool _Thread_Is_proxy_blocking (
-  uint32_t   code
-)
-{
-  return (code == THREAD_STATUS_PROXY_BLOCKING);
-}
-
-/**
- * This routine allocates an internal thread.
- */
-
-RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void )
-{
-  return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information );
-}
-
-/**
- * This routine frees an internal thread.
- */
-
-RTEMS_INLINE_ROUTINE void _Thread_Internal_free (
-  Thread_Control *the_task
-)
-{
-  _Objects_Free( &_Thread_Internal_information, &the_task->Object );
-}
-
-RTEMS_INLINE_ROUTINE void _Thread_Set_global_exit_status(
-  uint32_t exit_status
-)
-{
-  Thread_Control *idle = (Thread_Control *)
-    _Thread_Internal_information.local_table[ 1 ];
-
-  idle->Wait.return_code = exit_status;
-}
-
-RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_global_exit_status( void )
-{
-  const Thread_Control *idle = (const Thread_Control *)
-    _Thread_Internal_information.local_table[ 1 ];
-
-  return idle->Wait.return_code;
-}
-
-/**
- * @brief Issues a thread dispatch if necessary.
- *
- * @param[in] executing The executing thread.
- * @param[in] needs_asr_dispatching Indicates whether or not the API
- *            level signals are pending and a dispatch is necessary.
- */
-RTEMS_INLINE_ROUTINE void _Thread_Dispatch_if_necessary(
-  Thread_Control *executing,
-  bool            needs_asr_dispatching
-)
-{
-  if ( _Thread_Dispatch_is_enabled() ) {
-    bool dispatch_necessary = needs_asr_dispatching;
-
-    if ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) {
-      dispatch_necessary = true;
-      _Thread_Dispatch_necessary = dispatch_necessary;
-    }
-
-    if ( dispatch_necessary ) {
-      _Thread_Dispatch();
-    }
-  }
-}
-
-#if !defined(__DYNAMIC_REENT__)
-/**
- * This routine returns the C library re-enterant pointer.
- */
-
-RTEMS_INLINE_ROUTINE struct _reent **_Thread_Get_libc_reent( void )
-{
-  return _Thread_libc_reent;
-}
-
-/**
- * This routine set the C library re-enterant pointer.
- */
-
-RTEMS_INLINE_ROUTINE void _Thread_Set_libc_reent (
-  struct _reent **libc_reent
-)
-{
-  _Thread_libc_reent = libc_reent;
-}
-#endif
-
-/** @}*/
-
-#endif
-/* end of include file */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index c8625fb..e236716 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -215,6 +215,10 @@ $(PROJECT_INCLUDE)/rtems/score/thread.h: include/rtems/score/thread.h $(PROJECT_
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/thread.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.h
 
+$(PROJECT_INCLUDE)/rtems/score/threadimpl.h: include/rtems/score/threadimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadimpl.h
+
 $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h: include/rtems/score/threaddispatch.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h
@@ -331,10 +335,6 @@ $(PROJECT_INCLUDE)/rtems/score/states.inl: inline/rtems/score/states.inl $(PROJE
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/states.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/states.inl
 
-$(PROJECT_INCLUDE)/rtems/score/thread.inl: inline/rtems/score/thread.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/thread.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.inl
-
 $(PROJECT_INCLUDE)/rtems/score/threadq.inl: inline/rtems/score/threadq.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadq.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadq.inl
diff --git a/cpukit/score/src/corerwlocktimeout.c b/cpukit/score/src/corerwlocktimeout.c
index 1f5da2e..1c3db0e 100644
--- a/cpukit/score/src/corerwlocktimeout.c
+++ b/cpukit/score/src/corerwlocktimeout.c
@@ -18,9 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/score/corerwlockimpl.h>
-#include <rtems/score/threaddispatch.h>
+#include <rtems/score/threadimpl.h>
 
 void _CORE_RWLock_Timeout(
   Objects_Id  id,
diff --git a/cpukit/score/src/heap.c b/cpukit/score/src/heap.c
index 6773f2a..8312d41 100644
--- a/cpukit/score/src/heap.c
+++ b/cpukit/score/src/heap.c
@@ -22,6 +22,7 @@
 #endif
 
 #include <rtems/score/heapimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/interr.h>
 
 #include <string.h>
diff --git a/cpukit/score/src/heapfree.c b/cpukit/score/src/heapfree.c
index d15094c..8cf9518 100644
--- a/cpukit/score/src/heapfree.c
+++ b/cpukit/score/src/heapfree.c
@@ -19,8 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/score/heapimpl.h>
+#include <rtems/score/threadimpl.h>
 
 #ifndef HEAP_PROTECTION
   #define _Heap_Protection_determine_block_free( heap, block ) true
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 9ba6106..4cfdc85 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -27,7 +27,7 @@
 #include <rtems/score/cpu.h>
 #include <rtems/score/interr.h>
 #include <rtems/score/states.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/threadq.h>
 #include <rtems/score/tqdata.h>
 #include <rtems/score/watchdog.h>
diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c
index 5e1ac0f..2e2c18e 100644
--- a/cpukit/score/src/objectgetnameasstring.c
+++ b/cpukit/score/src/objectgetnameasstring.c
@@ -19,12 +19,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/score/object.h>
-#include <rtems/score/thread.h>
-#include <stdlib.h>
+#include <rtems/score/threadimpl.h>
+
 #include <ctype.h>
-#include <inttypes.h>
 
 /*
  *  This method objects the name of an object and returns its name
diff --git a/cpukit/score/src/objectidtoname.c b/cpukit/score/src/objectidtoname.c
index db739d8..54e4228 100644
--- a/cpukit/score/src/objectidtoname.c
+++ b/cpukit/score/src/objectidtoname.c
@@ -18,9 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/score/object.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 
 Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
   Objects_Id      id,
diff --git a/cpukit/score/src/schedulercbs.c b/cpukit/score/src/schedulercbs.c
index f3aa2c0..a782d97 100644
--- a/cpukit/score/src/schedulercbs.c
+++ b/cpukit/score/src/schedulercbs.c
@@ -19,7 +19,7 @@
 #endif
 
 #include <rtems/score/schedulercbs.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/wkspace.h>
 
 Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
diff --git a/cpukit/score/src/schedulercbsattachthread.c b/cpukit/score/src/schedulercbsattachthread.c
index 5192bc0..1a0d6f1 100644
--- a/cpukit/score/src/schedulercbsattachthread.c
+++ b/cpukit/score/src/schedulercbsattachthread.c
@@ -18,12 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/schedulercbs.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/rtems/object.h>
+#include <rtems/score/threadimpl.h>
 
 int _Scheduler_CBS_Attach_thread (
   Scheduler_CBS_Server_id server_id,
diff --git a/cpukit/score/src/schedulercbsdetachthread.c b/cpukit/score/src/schedulercbsdetachthread.c
index cbc37eb..b7b0d24 100644
--- a/cpukit/score/src/schedulercbsdetachthread.c
+++ b/cpukit/score/src/schedulercbsdetachthread.c
@@ -19,11 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/schedulercbs.h>
-#include <rtems/score/threaddispatch.h>
+#include <rtems/score/threadimpl.h>
 
 int _Scheduler_CBS_Detach_thread (
   Scheduler_CBS_Server_id server_id,
diff --git a/cpukit/score/src/schedulercbsgetexecutiontime.c b/cpukit/score/src/schedulercbsgetexecutiontime.c
index e54cb44..d4b18ae 100644
--- a/cpukit/score/src/schedulercbsgetexecutiontime.c
+++ b/cpukit/score/src/schedulercbsgetexecutiontime.c
@@ -19,11 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/schedulercbs.h>
-#include <rtems/score/threaddispatch.h>
+#include <rtems/score/threadimpl.h>
 
 int _Scheduler_CBS_Get_execution_time (
   Scheduler_CBS_Server_id   server_id,
diff --git a/cpukit/score/src/schedulercbsgetremainingbudget.c b/cpukit/score/src/schedulercbsgetremainingbudget.c
index 2ab0941..c4713fc 100644
--- a/cpukit/score/src/schedulercbsgetremainingbudget.c
+++ b/cpukit/score/src/schedulercbsgetremainingbudget.c
@@ -18,11 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/schedulercbs.h>
-#include <rtems/score/threaddispatch.h>
+#include <rtems/score/threadimpl.h>
 
 int _Scheduler_CBS_Get_remaining_budget (
   Scheduler_CBS_Server_id  server_id,
diff --git a/cpukit/score/src/schedulercbsreleasejob.c b/cpukit/score/src/schedulercbsreleasejob.c
index 23453ed..50cb908 100644
--- a/cpukit/score/src/schedulercbsreleasejob.c
+++ b/cpukit/score/src/schedulercbsreleasejob.c
@@ -19,10 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/schedulercbs.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Scheduler_CBS_Release_job(
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 04e8a5c..1e29c46 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -21,6 +21,7 @@
 
 #include <rtems/score/schedulercbs.h>
 #include <rtems/score/schedulerimpl.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Scheduler_CBS_Unblock(
diff --git a/cpukit/score/src/schedulerdefaulttick.c b/cpukit/score/src/schedulerdefaulttick.c
index 47844ed..a8a9f32 100644
--- a/cpukit/score/src/schedulerdefaulttick.c
+++ b/cpukit/score/src/schedulerdefaulttick.c
@@ -20,7 +20,7 @@
 #endif
 
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/smp.h>
 
 static void _Scheduler_default_Tick_for_executing( Thread_Control *executing )
diff --git a/cpukit/score/src/scheduleredfblock.c b/cpukit/score/src/scheduleredfblock.c
index 1eb6c29..4ad767d 100644
--- a/cpukit/score/src/scheduleredfblock.c
+++ b/cpukit/score/src/scheduleredfblock.c
@@ -19,12 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/context.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/scheduleredf.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 
 void _Scheduler_EDF_Block(
   Thread_Control    *the_thread
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index c43e71f..ec9a7d8 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -18,10 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduler.h>
 #include <rtems/score/scheduleredf.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Scheduler_EDF_Release_job(
diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c
index d5f5840..9e48101 100644
--- a/cpukit/score/src/schedulerpriorityblock.c
+++ b/cpukit/score/src/schedulerpriorityblock.c
@@ -21,6 +21,7 @@
 #endif
 
 #include <rtems/score/schedulerpriorityimpl.h>
+#include <rtems/score/threadimpl.h>
 
 void _Scheduler_priority_Block(
   Thread_Control   *the_thread
diff --git a/cpukit/score/src/schedulerpriorityyield.c b/cpukit/score/src/schedulerpriorityyield.c
index e65bdb8..fa9a1f1 100644
--- a/cpukit/score/src/schedulerpriorityyield.c
+++ b/cpukit/score/src/schedulerpriorityyield.c
@@ -20,6 +20,7 @@
 
 #include <rtems/score/schedulerpriorityimpl.h>
 #include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
 
 void _Scheduler_priority_Yield( Thread_Control *thread )
 {
diff --git a/cpukit/score/src/schedulersimpleblock.c b/cpukit/score/src/schedulersimpleblock.c
index 4287ddf..b9753b5 100644
--- a/cpukit/score/src/schedulersimpleblock.c
+++ b/cpukit/score/src/schedulersimpleblock.c
@@ -19,15 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/schedulersimple.h>
+#include <rtems/score/threadimpl.h>
 
 void _Scheduler_simple_Block(
   Thread_Control   *the_thread
diff --git a/cpukit/score/src/schedulersimpleyield.c b/cpukit/score/src/schedulersimpleyield.c
index 05f803e..cb8dc6f 100644
--- a/cpukit/score/src/schedulersimpleyield.c
+++ b/cpukit/score/src/schedulersimpleyield.c
@@ -20,6 +20,7 @@
 
 #include <rtems/score/schedulersimpleimpl.h>
 #include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
 
 void _Scheduler_simple_Yield( Thread_Control *thread )
 {
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 4d2a1b5..ed32d86 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -18,11 +18,11 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
 #include <rtems/bspsmp.h>
-#include <rtems/score/smp.h>
 #include <rtems/score/thread.h>
 #include <rtems/score/threaddispatch.h>
+#include <rtems/score/smp.h>
+#include <rtems/score/sysstate.h>
 
 #if defined(RTEMS_DEBUG)
   #include <rtems/bspIo.h>
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index 391ea52..9d2301b 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -18,26 +18,11 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/scheduler.h>
-#include <rtems/score/states.h>
 #include <rtems/score/sysstate.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
 #include <rtems/config.h>
 
-#if defined(RTEMS_SMP)
-  #include <rtems/bspsmp.h>
-#endif
-
 void _Thread_Handler_initialization(void)
 {
   uint32_t ticks_per_timeslice =
@@ -83,11 +68,7 @@ void _Thread_Handler_initialization(void)
    *  per CPU in an SMP system.  In addition, if this is a loosely
    *  coupled multiprocessing system, account for the MPCI Server Thread.
    */
-  #if defined(RTEMS_SMP)
-    maximum_internal_threads = rtems_configuration_get_maximum_processors();
-  #else
-    maximum_internal_threads = 1;
-  #endif
+  maximum_internal_threads = rtems_configuration_get_maximum_processors();
 
   #if defined(RTEMS_MULTIPROCESSING)
     if ( _System_state_Is_multiprocessing )
diff --git a/cpukit/score/src/threadblockingoperationcancel.c b/cpukit/score/src/threadblockingoperationcancel.c
index 278dec5..70bdb3d 100644
--- a/cpukit/score/src/threadblockingoperationcancel.c
+++ b/cpukit/score/src/threadblockingoperationcancel.c
@@ -18,8 +18,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #if defined(RTEMS_DEBUG)
 #include <rtems/score/interr.h>
 #endif
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index 3d770d2..b919ddd 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -19,7 +19,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/isr.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/threadq.h>
diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c
index 0a02bdd..6afd04f 100644
--- a/cpukit/score/src/threadclearstate.c
+++ b/cpukit/score/src/threadclearstate.c
@@ -18,9 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/states.h>
 
 void _Thread_Clear_state(
   Thread_Control *the_thread,
diff --git a/cpukit/score/src/threadclose.c b/cpukit/score/src/threadclose.c
index da5f556..9866a5c 100644
--- a/cpukit/score/src/threadclose.c
+++ b/cpukit/score/src/threadclose.c
@@ -18,10 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
-#include <rtems/score/object.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
-#include <rtems/score/threaddispatch.h>
 #include <rtems/score/threadq.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/watchdogimpl.h>
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index cef6d03..181978b 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -18,19 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/smp.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/stackimpl.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
 #include <rtems/config.h>
 
 static void _Thread_Create_idle_for_cpu( Per_CPU_Control *per_cpu )
diff --git a/cpukit/score/src/threaddelayended.c b/cpukit/score/src/threaddelayended.c
index 98b2f03..7505d3e 100644
--- a/cpukit/score/src/threaddelayended.c
+++ b/cpukit/score/src/threaddelayended.c
@@ -18,18 +18,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
+#include <rtems/score/threadimpl.h>
 
 void _Thread_Delay_ended(
   Objects_Id  id,
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index 177a3d8..b91eca8 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -18,28 +18,14 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
+#include <rtems/score/threaddispatch.h>
 #include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/score/threadq.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/tod.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/wkspace.h>
 
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
-  #include <rtems/score/timestamp.h>
-#endif
-
-#if defined(RTEMS_SMP)
-  #include <rtems/score/smp.h>
-#endif
-
 void _Thread_Dispatch( void )
 {
   Thread_Control   *executing;
diff --git a/cpukit/score/src/threadget.c b/cpukit/score/src/threadget.c
index a2b81b3..5bb7665 100644
--- a/cpukit/score/src/threadget.c
+++ b/cpukit/score/src/threadget.c
@@ -19,17 +19,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/score/threadq.h>
+#include <rtems/score/threadimpl.h>
 
 Thread_Control *_Thread_Get (
   Objects_Id         id,
diff --git a/cpukit/score/src/threadhandler.c b/cpukit/score/src/threadhandler.c
index fa57fc5..1fde4cd 100644
--- a/cpukit/score/src/threadhandler.c
+++ b/cpukit/score/src/threadhandler.c
@@ -18,22 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/score/threadq.h>
+#include <rtems/score/isrlevel.h>
 #include <rtems/score/userextimpl.h>
-#include <rtems/score/wkspace.h>
-#if defined(RTEMS_SMP)
-  #include <rtems/score/smp.h>
-#endif
 
 /*
  *  Conditional magic to determine what style of C++ constructor
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 2075293..e9e8a0b 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -17,16 +17,14 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
-#include <rtems/config.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/stackimpl.h>
 #include <rtems/score/threadq.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/watchdogimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/config.h>
 
 bool _Thread_Initialize(
   Objects_Information                  *information,
diff --git a/cpukit/score/src/threadloadenv.c b/cpukit/score/src/threadloadenv.c
index b368b74..ad33626 100644
--- a/cpukit/score/src/threadloadenv.c
+++ b/cpukit/score/src/threadloadenv.c
@@ -19,17 +19,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
+#include <rtems/score/threadimpl.h>
 
 void _Thread_Load_environment(
   Thread_Control *the_thread
diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c
index 9b85873..b33dad5 100644
--- a/cpukit/score/src/threadmp.c
+++ b/cpukit/score/src/threadmp.c
@@ -20,7 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/priority.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/mpci.h>
 #include <rtems/score/wkspace.h>
 #include <rtems/score/isr.h>
diff --git a/cpukit/score/src/threadqdequeuefifo.c b/cpukit/score/src/threadqdequeuefifo.c
index b00b581..717cb59 100644
--- a/cpukit/score/src/threadqdequeuefifo.c
+++ b/cpukit/score/src/threadqdequeuefifo.c
@@ -18,14 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/chainimpl.h>
+#include <rtems/score/isrlevel.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 Thread_Control *_Thread_queue_Dequeue_fifo(
diff --git a/cpukit/score/src/threadqdequeuepriority.c b/cpukit/score/src/threadqdequeuepriority.c
index 0162488..49b4eae 100644
--- a/cpukit/score/src/threadqdequeuepriority.c
+++ b/cpukit/score/src/threadqdequeuepriority.c
@@ -18,14 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/chainimpl.h>
+#include <rtems/score/isrlevel.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 Thread_Control *_Thread_queue_Dequeue_priority(
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 41cfd74..a4f0018 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -21,14 +21,9 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/isrlevel.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Thread_queue_Enqueue_with_handler(
diff --git a/cpukit/score/src/threadqextractfifo.c b/cpukit/score/src/threadqextractfifo.c
index a0d52af..cd5df75 100644
--- a/cpukit/score/src/threadqextractfifo.c
+++ b/cpukit/score/src/threadqextractfifo.c
@@ -19,14 +19,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/chainimpl.h>
+#include <rtems/score/isrlevel.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Thread_queue_Extract_fifo(
diff --git a/cpukit/score/src/threadqextractpriority.c b/cpukit/score/src/threadqextractpriority.c
index 29a1c64..c797d3b 100644
--- a/cpukit/score/src/threadqextractpriority.c
+++ b/cpukit/score/src/threadqextractpriority.c
@@ -18,14 +18,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/chainimpl.h>
+#include <rtems/score/isrlevel.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Thread_queue_Extract_priority_helper(
diff --git a/cpukit/score/src/threadqprocesstimeout.c b/cpukit/score/src/threadqprocesstimeout.c
index c596b95..ee15d49 100644
--- a/cpukit/score/src/threadqprocesstimeout.c
+++ b/cpukit/score/src/threadqprocesstimeout.c
@@ -18,14 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/threadimpl.h>
 
 void _Thread_queue_Process_timeout(
   Thread_Control *the_thread
diff --git a/cpukit/score/src/threadqtimeout.c b/cpukit/score/src/threadqtimeout.c
index c310551..07e8e4e 100644
--- a/cpukit/score/src/threadqtimeout.c
+++ b/cpukit/score/src/threadqtimeout.c
@@ -18,15 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threaddispatch.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/tqdata.h>
+#include <rtems/score/threadimpl.h>
 
 void _Thread_queue_Timeout(
   Objects_Id  id,
diff --git a/cpukit/score/src/threadready.c b/cpukit/score/src/threadready.c
index d926a19..5bb925c 100644
--- a/cpukit/score/src/threadready.c
+++ b/cpukit/score/src/threadready.c
@@ -18,8 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
-#include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/isrlevel.h>
 #include <rtems/score/schedulerimpl.h>
 
 void _Thread_Ready(
diff --git a/cpukit/score/src/threadreset.c b/cpukit/score/src/threadreset.c
index fb4278d..a9527d1 100644
--- a/cpukit/score/src/threadreset.c
+++ b/cpukit/score/src/threadreset.c
@@ -18,17 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
 #include <rtems/score/watchdogimpl.h>
 
 void _Thread_Reset(
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 26dd61a..24ad48a 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -18,18 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/userextimpl.h>
-#include <rtems/score/wkspace.h>
 
 bool _Thread_Restart(
   Thread_Control            *the_thread,
diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c
index f776014..d42627f 100644
--- a/cpukit/score/src/threadsetpriority.c
+++ b/cpukit/score/src/threadsetpriority.c
@@ -18,7 +18,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
 
 void _Thread_Set_priority(
diff --git a/cpukit/score/src/threadsetstate.c b/cpukit/score/src/threadsetstate.c
index 0b25442..251275e 100644
--- a/cpukit/score/src/threadsetstate.c
+++ b/cpukit/score/src/threadsetstate.c
@@ -21,8 +21,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
-#include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/isrlevel.h>
 #include <rtems/score/schedulerimpl.h>
 
 void _Thread_Set_state(
diff --git a/cpukit/score/src/threadsettransient.c b/cpukit/score/src/threadsettransient.c
index ecdbd71..866bb6e 100644
--- a/cpukit/score/src/threadsettransient.c
+++ b/cpukit/score/src/threadsettransient.c
@@ -19,8 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
-#include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/isrlevel.h>
 #include <rtems/score/schedulerimpl.h>
 
 void _Thread_Set_transient(
diff --git a/cpukit/score/src/threadstackallocate.c b/cpukit/score/src/threadstackallocate.c
index 5d9230e..bdabac9 100644
--- a/cpukit/score/src/threadstackallocate.c
+++ b/cpukit/score/src/threadstackallocate.c
@@ -19,18 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/stackimpl.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
 #include <rtems/config.h>
 
 size_t _Thread_Stack_Allocate(
diff --git a/cpukit/score/src/threadstackfree.c b/cpukit/score/src/threadstackfree.c
index 0e59ef7..d670e3d 100644
--- a/cpukit/score/src/threadstackfree.c
+++ b/cpukit/score/src/threadstackfree.c
@@ -18,17 +18,7 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/config.h>
 
 void _Thread_Stack_Free(
diff --git a/cpukit/score/src/threadstart.c b/cpukit/score/src/threadstart.c
index 82f8a2a..81c7b37 100644
--- a/cpukit/score/src/threadstart.c
+++ b/cpukit/score/src/threadstart.c
@@ -19,8 +19,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/score/thread.h>
-#include <rtems/score/isr.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/isrlevel.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/userextimpl.h>
 
diff --git a/cpukit/score/src/threadstartmultitasking.c b/cpukit/score/src/threadstartmultitasking.c
index 16d1328..459d0d6 100644
--- a/cpukit/score/src/threadstartmultitasking.c
+++ b/cpukit/score/src/threadstartmultitasking.c
@@ -18,18 +18,8 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <rtems/score/apiext.h>
-#include <rtems/score/context.h>
-#include <rtems/score/interr.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/object.h>
-#include <rtems/score/priority.h>
-#include <rtems/score/states.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/sysstate.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
-#include <rtems/score/wkspace.h>
 
 void _Thread_Start_multitasking( void )
 {
diff --git a/testsuites/sptests/spsimplesched02/init.c b/testsuites/sptests/spsimplesched02/init.c
index d4faa7a..074dbc0 100644
--- a/testsuites/sptests/spsimplesched02/init.c
+++ b/testsuites/sptests/spsimplesched02/init.c
@@ -13,6 +13,8 @@
 
 #include <tmacros.h>
 
+#include <rtems/score/threadimpl.h>
+
 /* forward declarations to avoid warnings */
 rtems_task Init(rtems_task_argument argument);
 rtems_task Test_task(rtems_task_argument argument);
diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h
index 6ab6e23..c8ace40 100644
--- a/testsuites/support/include/tmacros.h
+++ b/testsuites/support/include/tmacros.h
@@ -22,8 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <rtems/error.h>
-#include <rtems/score/thread.h> /*  _Thread_Dispatch_disable_level */
-#include <rtems/score/thread.inl> /*  _Thread_Dispatch_disable_level */
+#include <rtems/score/threaddispatch.h>
 
 #ifdef __cplusplus
 extern "C" {




More information about the vc mailing list