forked from Imagelibrary/rtems
score: Simplify <rtems/score/thread.h>
Avoid Thread_Control typedef in <rtems/score/percpu.h>. This helps to get rid of the <rtems/score/percpu.h> include in <rtems/score/thread.h> which exposes a lot of implementation details.
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include <rtems/posix/sigset.h>
|
#include <rtems/posix/sigset.h>
|
||||||
#include <rtems/score/apiext.h>
|
#include <rtems/score/apiext.h>
|
||||||
#include <rtems/score/isrlock.h>
|
#include <rtems/score/isrlock.h>
|
||||||
|
#include <rtems/score/percpu.h>
|
||||||
#include <rtems/score/threadqimpl.h>
|
#include <rtems/score/threadqimpl.h>
|
||||||
|
|
||||||
#define _States_Is_interruptible_signal( _states ) \
|
#define _States_Is_interruptible_signal( _states ) \
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#define _RTEMS_RTEMS_SIGNALIMPL_H
|
#define _RTEMS_RTEMS_SIGNALIMPL_H
|
||||||
|
|
||||||
#include <rtems/rtems/signal.h>
|
#include <rtems/rtems/signal.h>
|
||||||
|
#include <rtems/score/percpu.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -51,10 +51,7 @@ extern "C" {
|
|||||||
|
|
||||||
#if !defined( ASM )
|
#if !defined( ASM )
|
||||||
|
|
||||||
#ifndef __THREAD_CONTROL_DEFINED__
|
struct Thread_Control;
|
||||||
#define __THREAD_CONTROL_DEFINED__
|
|
||||||
typedef struct Thread_Control_struct Thread_Control;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Scheduler_Context;
|
struct Scheduler_Context;
|
||||||
|
|
||||||
@@ -276,7 +273,7 @@ typedef struct Per_CPU_Control {
|
|||||||
* configurations use _Thread_Is_executing_on_a_processor() to figure out if
|
* configurations use _Thread_Is_executing_on_a_processor() to figure out if
|
||||||
* a thread context is executing on a processor.
|
* a thread context is executing on a processor.
|
||||||
*/
|
*/
|
||||||
Thread_Control *executing;
|
struct Thread_Control *executing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the heir thread for this processor.
|
* @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().
|
* @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
|
* @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 \
|
#define _Thread_Time_of_last_context_switch \
|
||||||
_Per_CPU_Get()->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 ) */
|
#endif /* !defined( ASM ) */
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <rtems/score/isrlock.h>
|
#include <rtems/score/isrlock.h>
|
||||||
#include <rtems/score/object.h>
|
#include <rtems/score/object.h>
|
||||||
#include <rtems/score/percpu.h>
|
|
||||||
#include <rtems/score/priority.h>
|
#include <rtems/score/priority.h>
|
||||||
#include <rtems/score/resource.h>
|
#include <rtems/score/resource.h>
|
||||||
#include <rtems/score/stack.h>
|
#include <rtems/score/stack.h>
|
||||||
@@ -40,6 +39,8 @@
|
|||||||
#include <rtems/score/cpuset.h>
|
#include <rtems/score/cpuset.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct Per_CPU_Control;
|
||||||
|
|
||||||
struct Scheduler_Control;
|
struct Scheduler_Control;
|
||||||
|
|
||||||
struct Scheduler_Node;
|
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().
|
* @param[in] level The ISR level for _Thread_Action_release_and_ISR_enable().
|
||||||
*/
|
*/
|
||||||
typedef void ( *Thread_Action_handler )(
|
typedef void ( *Thread_Action_handler )(
|
||||||
Thread_Control *thread,
|
Thread_Control *thread,
|
||||||
Thread_Action *action,
|
Thread_Action *action,
|
||||||
Per_CPU_Control *cpu,
|
struct Per_CPU_Control *cpu,
|
||||||
ISR_Level level
|
ISR_Level level
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -611,14 +612,14 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* @brief The processor assigned by the current scheduler.
|
* @brief The processor assigned by the current scheduler.
|
||||||
*/
|
*/
|
||||||
Per_CPU_Control *cpu;
|
struct Per_CPU_Control *cpu;
|
||||||
|
|
||||||
#if defined(RTEMS_DEBUG)
|
#if defined(RTEMS_DEBUG)
|
||||||
/**
|
/**
|
||||||
* @brief The processor on which this thread executed the last time or is
|
* @brief The processor on which this thread executed the last time or is
|
||||||
* executing.
|
* executing.
|
||||||
*/
|
*/
|
||||||
Per_CPU_Control *debug_real_cpu;
|
struct Per_CPU_Control *debug_real_cpu;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} Thread_Scheduler_control;
|
} Thread_Scheduler_control;
|
||||||
@@ -667,7 +668,7 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* This structure defines the Thread Control Block (TCB).
|
* 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. */
|
/** This field is the object management structure for each thread. */
|
||||||
Objects_Control Object;
|
Objects_Control Object;
|
||||||
/** This field is the current execution state of this thread. */
|
/** 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
|
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.
|
* @brief Thread control add-on.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,10 +21,8 @@
|
|||||||
|
|
||||||
#include <rtems/score/chain.h>
|
#include <rtems/score/chain.h>
|
||||||
#include <rtems/score/isrlock.h>
|
#include <rtems/score/isrlock.h>
|
||||||
#include <rtems/score/percpu.h>
|
|
||||||
#include <rtems/score/priority.h>
|
#include <rtems/score/priority.h>
|
||||||
#include <rtems/score/rbtree.h>
|
#include <rtems/score/rbtree.h>
|
||||||
#include <rtems/score/states.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -41,6 +39,8 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
|
typedef struct Thread_Control Thread_Control;
|
||||||
|
|
||||||
typedef struct Thread_queue_Control Thread_queue_Control;
|
typedef struct Thread_queue_Control Thread_queue_Control;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user