From bd67d7d2f8c9925517416b58196ca4c8fe389fef Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 25 Jun 2015 13:48:00 +0200 Subject: score: Simplify Avoid Thread_Control typedef in . This helps to get rid of the include in which exposes a lot of implementation details. --- cpukit/posix/include/rtems/posix/psignalimpl.h | 1 + cpukit/rtems/include/rtems/rtems/signalimpl.h | 1 + cpukit/score/include/rtems/score/percpu.h | 37 +++++++++++++++++---- cpukit/score/include/rtems/score/thread.h | 45 ++++++-------------------- cpukit/score/include/rtems/score/threadq.h | 4 +-- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/cpukit/posix/include/rtems/posix/psignalimpl.h b/cpukit/posix/include/rtems/posix/psignalimpl.h index 166705b37b..d7e1afab70 100644 --- a/cpukit/posix/include/rtems/posix/psignalimpl.h +++ b/cpukit/posix/include/rtems/posix/psignalimpl.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #define _States_Is_interruptible_signal( _states ) \ diff --git a/cpukit/rtems/include/rtems/rtems/signalimpl.h b/cpukit/rtems/include/rtems/rtems/signalimpl.h index ddbe00ba5e..e093394462 100644 --- a/cpukit/rtems/include/rtems/rtems/signalimpl.h +++ b/cpukit/rtems/include/rtems/rtems/signalimpl.h @@ -18,6 +18,7 @@ #define _RTEMS_RTEMS_SIGNALIMPL_H #include +#include #include #ifdef __cplusplus diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index 600f46e377..a6f7a25cc6 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -51,10 +51,7 @@ extern "C" { #if !defined( ASM ) -#ifndef __THREAD_CONTROL_DEFINED__ -#define __THREAD_CONTROL_DEFINED__ -typedef struct Thread_Control_struct Thread_Control; -#endif +struct Thread_Control; struct Scheduler_Context; @@ -276,7 +273,7 @@ typedef struct Per_CPU_Control { * configurations use _Thread_Is_executing_on_a_processor() to figure out if * a thread context is executing on a processor. */ - Thread_Control *executing; + struct Thread_Control *executing; /** * @brief This is the heir thread for this processor. @@ -290,7 +287,7 @@ typedef struct Per_CPU_Control { * * @see _Thread_Get_heir_and_make_it_executing(). */ - Thread_Control *heir; + struct Thread_Control *heir; /** * @brief This is set to true when this processor needs to run the @@ -595,6 +592,34 @@ bool _Per_CPU_State_wait_for_non_initial_state( #define _Thread_Time_of_last_context_switch \ _Per_CPU_Get()->time_of_last_context_switch +/** + * @brief Returns the thread control block of the executing thread. + * + * This function can be called in any context. On SMP configurations + * interrupts are disabled to ensure that the processor index is used + * consistently. + * + * @return The thread control block of the executing thread. + */ +RTEMS_INLINE_ROUTINE struct Thread_Control *_Thread_Get_executing( void ) +{ + struct Thread_Control *executing; + + #if defined( RTEMS_SMP ) + ISR_Level level; + + _ISR_Disable_without_giant( level ); + #endif + + executing = _Thread_Executing; + + #if defined( RTEMS_SMP ) + _ISR_Enable_without_giant( level ); + #endif + + return executing; +} + /**@}*/ #endif /* !defined( ASM ) */ diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 05c1ff79b9..9d8382cf88 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -28,7 +28,6 @@ #endif #include #include -#include #include #include #include @@ -40,6 +39,8 @@ #include #endif +struct Per_CPU_Control; + struct Scheduler_Control; struct Scheduler_Node; @@ -453,10 +454,10 @@ typedef struct Thread_Action Thread_Action; * @param[in] level The ISR level for _Thread_Action_release_and_ISR_enable(). */ typedef void ( *Thread_Action_handler )( - Thread_Control *thread, - Thread_Action *action, - Per_CPU_Control *cpu, - ISR_Level level + Thread_Control *thread, + Thread_Action *action, + struct Per_CPU_Control *cpu, + ISR_Level level ); /** @@ -611,14 +612,14 @@ typedef struct { /** * @brief The processor assigned by the current scheduler. */ - Per_CPU_Control *cpu; + struct Per_CPU_Control *cpu; #if defined(RTEMS_DEBUG) /** * @brief The processor on which this thread executed the last time or is * executing. */ - Per_CPU_Control *debug_real_cpu; + struct Per_CPU_Control *debug_real_cpu; #endif #endif } Thread_Scheduler_control; @@ -667,7 +668,7 @@ typedef struct { /** * This structure defines the Thread Control Block (TCB). */ -struct Thread_Control_struct { +struct Thread_Control { /** This field is the object management structure for each thread. */ Objects_Control Object; /** This field is the current execution state of this thread. */ @@ -850,34 +851,6 @@ void rtems_iterate_over_all_threads( rtems_per_thread_routine routine ); -/** - * @brief Returns the thread control block of the executing thread. - * - * This function can be called in any context. On SMP configurations - * interrupts are disabled to ensure that the processor index is used - * consistently. - * - * @return The thread control block of the executing thread. - */ -RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_executing( void ) -{ - Thread_Control *executing; - - #if defined( RTEMS_SMP ) - ISR_Level level; - - _ISR_Disable_without_giant( level ); - #endif - - executing = _Thread_Executing; - - #if defined( RTEMS_SMP ) - _ISR_Enable_without_giant( level ); - #endif - - return executing; -} - /** * @brief Thread control add-on. */ diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 4a8db7c59d..06ea36a905 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -21,10 +21,8 @@ #include #include -#include #include #include -#include #ifdef __cplusplus extern "C" { @@ -41,6 +39,8 @@ extern "C" { */ /**@{*/ +typedef struct Thread_Control Thread_Control; + typedef struct Thread_queue_Control Thread_queue_Control; /** -- cgit v1.2.3