summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/libcsupport/src/error.c1
-rw-r--r--cpukit/libcsupport/src/newlibc_reent.c1
-rw-r--r--cpukit/posix/src/alarm.c6
-rw-r--r--cpukit/posix/src/cancel.c6
-rw-r--r--cpukit/posix/src/nanosleep.c2
-rw-r--r--cpukit/posix/src/psignalunblockthread.c2
-rw-r--r--cpukit/posix/src/pthread.c2
-rw-r--r--cpukit/posix/src/pthreadcreate.c7
-rw-r--r--cpukit/posix/src/pthreaddetach.c3
-rw-r--r--cpukit/posix/src/pthreadequal.c3
-rw-r--r--cpukit/posix/src/pthreadexit.c5
-rw-r--r--cpukit/posix/src/pthreadgetschedparam.c2
-rw-r--r--cpukit/posix/src/pthreadjoin.c3
-rw-r--r--cpukit/posix/src/pthreadkill.c2
-rw-r--r--cpukit/posix/src/pthreadsetschedparam.c4
-rw-r--r--cpukit/posix/src/sched_rr_get_interval.c2
-rw-r--r--cpukit/posix/src/ualarm.c8
-rw-r--r--cpukit/rtems/src/clocktick.c2
-rw-r--r--cpukit/rtems/src/eventseize.c1
-rw-r--r--cpukit/rtems/src/eventsend.c1
-rw-r--r--cpukit/rtems/src/eventsurrender.c1
-rw-r--r--cpukit/rtems/src/eventtimeout.c1
-rw-r--r--cpukit/rtems/src/msgmp.c1
-rw-r--r--cpukit/rtems/src/msgqtranslatereturncode.c2
-rw-r--r--cpukit/rtems/src/partmp.c1
-rw-r--r--cpukit/rtems/src/ratemoncancel.c2
-rw-r--r--cpukit/rtems/src/ratemonperiod.c2
-rw-r--r--cpukit/rtems/src/ratemontimeout.c7
-rw-r--r--cpukit/rtems/src/regionmp.c1
-rw-r--r--cpukit/rtems/src/signalmp.c1
-rw-r--r--cpukit/rtems/src/signalsend.c9
-rw-r--r--cpukit/rtems/src/systemeventsend.c1
-rw-r--r--cpukit/rtems/src/taskcreate.c18
-rw-r--r--cpukit/rtems/src/taskdelete.c15
-rw-r--r--cpukit/rtems/src/taskgetnote.c15
-rw-r--r--cpukit/rtems/src/taskissuspended.c15
-rw-r--r--cpukit/rtems/src/taskmode.c16
-rw-r--r--cpukit/rtems/src/taskmp.c1
-rw-r--r--cpukit/rtems/src/taskrestart.c15
-rw-r--r--cpukit/rtems/src/taskresume.c13
-rw-r--r--cpukit/rtems/src/tasksetnote.c15
-rw-r--r--cpukit/rtems/src/tasksetpriority.c13
-rw-r--r--cpukit/rtems/src/taskstart.c15
-rw-r--r--cpukit/rtems/src/tasksuspend.c13
-rw-r--r--cpukit/rtems/src/taskvariable_invoke_dtor.c2
-rw-r--r--cpukit/rtems/src/taskvariableadd.c6
-rw-r--r--cpukit/rtems/src/taskvariabledelete.c4
-rw-r--r--cpukit/rtems/src/taskvariableget.c4
-rw-r--r--cpukit/rtems/src/taskwakeafter.c4
-rw-r--r--cpukit/rtems/src/taskwakewhen.c15
-rw-r--r--cpukit/rtems/src/timerserver.c11
-rw-r--r--cpukit/sapi/src/exinit.c2
-rw-r--r--cpukit/sapi/src/exshutdown.c3
-rw-r--r--cpukit/score/Makefile.am2
-rw-r--r--cpukit/score/include/rtems/score/coremuteximpl.h2
-rw-r--r--cpukit/score/include/rtems/score/thread.h454
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h691
-rw-r--r--cpukit/score/include/rtems/score/threadmp.h4
-rw-r--r--cpukit/score/inline/rtems/score/thread.inl275
-rw-r--r--cpukit/score/preinstall.am8
-rw-r--r--cpukit/score/src/corerwlocktimeout.c3
-rw-r--r--cpukit/score/src/heap.c1
-rw-r--r--cpukit/score/src/heapfree.c2
-rw-r--r--cpukit/score/src/mpci.c2
-rw-r--r--cpukit/score/src/objectgetnameasstring.c6
-rw-r--r--cpukit/score/src/objectidtoname.c3
-rw-r--r--cpukit/score/src/schedulercbs.c2
-rw-r--r--cpukit/score/src/schedulercbsattachthread.c6
-rw-r--r--cpukit/score/src/schedulercbsdetachthread.c5
-rw-r--r--cpukit/score/src/schedulercbsgetexecutiontime.c5
-rw-r--r--cpukit/score/src/schedulercbsgetremainingbudget.c5
-rw-r--r--cpukit/score/src/schedulercbsreleasejob.c4
-rw-r--r--cpukit/score/src/schedulercbsunblock.c1
-rw-r--r--cpukit/score/src/schedulerdefaulttick.c2
-rw-r--r--cpukit/score/src/scheduleredfblock.c6
-rw-r--r--cpukit/score/src/scheduleredfreleasejob.c4
-rw-r--r--cpukit/score/src/schedulerpriorityblock.c1
-rw-r--r--cpukit/score/src/schedulerpriorityyield.c1
-rw-r--r--cpukit/score/src/schedulersimpleblock.c9
-rw-r--r--cpukit/score/src/schedulersimpleyield.c1
-rw-r--r--cpukit/score/src/smp.c4
-rw-r--r--cpukit/score/src/thread.c23
-rw-r--r--cpukit/score/src/threadblockingoperationcancel.c3
-rw-r--r--cpukit/score/src/threadchangepriority.c2
-rw-r--r--cpukit/score/src/threadclearstate.c3
-rw-r--r--cpukit/score/src/threadclose.c4
-rw-r--r--cpukit/score/src/threadcreateidle.c13
-rw-r--r--cpukit/score/src/threaddelayended.c13
-rw-r--r--cpukit/score/src/threaddispatch.c20
-rw-r--r--cpukit/score/src/threadget.c12
-rw-r--r--cpukit/score/src/threadhandler.c16
-rw-r--r--cpukit/score/src/threadinitialize.c6
-rw-r--r--cpukit/score/src/threadloadenv.c12
-rw-r--r--cpukit/score/src/threadmp.c2
-rw-r--r--cpukit/score/src/threadqdequeuefifo.c10
-rw-r--r--cpukit/score/src/threadqdequeuepriority.c10
-rw-r--r--cpukit/score/src/threadqenqueue.c9
-rw-r--r--cpukit/score/src/threadqextractfifo.c10
-rw-r--r--cpukit/score/src/threadqextractpriority.c10
-rw-r--r--cpukit/score/src/threadqprocesstimeout.c8
-rw-r--r--cpukit/score/src/threadqtimeout.c9
-rw-r--r--cpukit/score/src/threadready.c4
-rw-r--r--cpukit/score/src/threadreset.c11
-rw-r--r--cpukit/score/src/threadrestart.c12
-rw-r--r--cpukit/score/src/threadsetpriority.c2
-rw-r--r--cpukit/score/src/threadsetstate.c4
-rw-r--r--cpukit/score/src/threadsettransient.c4
-rw-r--r--cpukit/score/src/threadstackallocate.c12
-rw-r--r--cpukit/score/src/threadstackfree.c12
-rw-r--r--cpukit/score/src/threadstart.c4
-rw-r--r--cpukit/score/src/threadstartmultitasking.c12
-rw-r--r--testsuites/sptests/spsimplesched02/init.c2
-rw-r--r--testsuites/support/include/tmacros.h3
113 files changed, 873 insertions, 1220 deletions
diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c
index 6993ea144b..9933e14d60 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 0e674723d4..50fd8399cf 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 be3a334f37..acdec65574 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 9ea7f93319..e896f1dec8 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 84ac832955..3c408ebe68 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 cbdbd38c66..51b034db21 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 3df7478779..f4dcc214cd 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 4742b596d6..64270e94d9 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 3b99a9c476..74df253bd3 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 f398e5cf7a..dd9c53373f 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 03a56c9e96..296c32be11 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 7f034cbb78..6876e1387e 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 9dc1b240e8..18039d3829 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 02a9ee7d4d..11287facba 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 a8ac4458dd..a54a689b9e 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 c606bc9ef2..242077d337 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 e94eb12492..17573ba6ec 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 a6e4ac30cd..1b1624f211 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 995aeb4468..32eacd451a 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 c7d874a657..807bf79f7a 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 10453fea01..d3af8b897d 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 4ec7fa0418..24ae46eff0 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 a2b49ea130..d5162511af 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 a6f912b3f5..aeedff7bf3 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 d3b4f73268..ea880266d2 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 8303afde45..4a87fe0a1d 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 078b06d714..25e64b2f30 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 947fa2f8c4..4f20595110 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 6828fbb451..f0dc4d8864 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 f70a452208..29054cd72d 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 f8002e5789..56f5416dab 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 73aa2e186a..129fa88365 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 d80e9ed90c..03ea10ab53 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 a43e222add..82866f2af2 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 430e9a3220..cd31d8a54d 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 ee47787032..dd6a7a319a 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 bcfdc50408..bbe59bb6df 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 78738c2245..2dec74a3a6 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 66f4604b53..10b159dc16 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 ee06dca932..60af82e691 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 f79baaa238..9aa8a08322 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 b522fd2ddf..385990c635 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 ae4b707dac..a5dac15697 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 a88e211ce0..dced5d22da 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 db13f0992a..3a22fb4879 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 a241a11593..1636d9814e 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 df5fc62888..687ffad39c 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 ec6d3c6f75..14ad1d1e7a 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 59c4f07a69..eee5771fc8 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 31eb5d849d..7bee637bcc 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 9e66544950..5c7099c561 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 91eac2aafe..0c4e1b0953 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 a54b1e6e86..7a96869e27 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 617b99c79e..5b33078edf 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 af7c3fa423..756cd969cd 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 4300d1a55d..c07350bc5a 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 0000000000..205c704508
--- /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 6c9788fe28..555bca2053 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 9c0aecb01a..0000000000
--- 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 c8625fba43..e236716657 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 1f5da2e046..1c3db0ef0b 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 6773f2ac52..8312d419c1 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 d15094ce77..8cf95182a3 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 9ba6106555..4cfdc85f7f 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 5e1ac0f57b..2e2c18ee6b 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 db739d8847..54e4228b28 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 f3aa2c0261..a782d97c7a 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 5192bc0779..1a0d6f1e7a 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 cbc37eb195..b7b0d24aea 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 e54cb44141..d4b18ae74c 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 2ab0941c9f..c4713fcdf4 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 23453ed5c1..50cb9081bc 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 04e8a5c9a3..1e29c467ae 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 47844ed4be..a8a9f322cb 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 1eb6c29931..4ad767d7bf 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 c43e71f04d..ec9a7d88b6 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 d5f5840cba..9e48101f9e 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 e65bdb8af6..fa9a1f1271 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 4287ddf2c6..b9753b5954 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 05f803e791..cb8dc6fc92 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 4d2a1b52f8..ed32d86a92 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 391ea52665..9d2301b156 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 278dec51c8..70bdb3da18 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 3d770d285d..b919ddd2d2 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 0a02bdd48e..6afd04f8ce 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 da5f556084..9866a5c507 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 cef6d03886..181978bc81 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 98b2f03b2c..7505d3e07e 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 177a3d839d..b91eca8165 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 a2b81b3e14..5bb76654b9 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 fa57fc510b..1fde4cd4e5 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 2075293fd2..e9e8a0b112 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 b368b748b1..ad33626526 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 9b85873f7d..b33dad5284 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 b00b58189f..717cb593ad 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 0162488a9e..49b4eae68e 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 41cfd74080..a4f00188da 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 a0d52af2ff..cd5df75dd7 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 29a1c645a8..c797d3bba3 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 c596b959a4..ee15d49bb3 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 c310551f9e..07e8e4e8de 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 d926a19fff..5bb925c4b5 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 fb4278de1b..a9527d1757 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 26dd61aac2..24ad48a668 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 f776014779..d42627f2e8 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 0b25442a38..251275e150 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 ecdbd71576..866bb6ef97 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 5d9230efd0..bdabac90bf 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 0e59ef7915..d670e3d754 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 82f8a2a235..81c7b37bd0 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 16d1328148..459d0d6f9b 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 d4faa7ad3d..074dbc0198 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 6ab6e23895..c8ace400b5 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" {