diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-12 09:25:39 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-14 16:26:06 +0200 |
commit | 49cdf40afa1b67b1eedbec26b73c59f54dc882cd (patch) | |
tree | d5f27895d8bb30533150c66fd019a18291a52e6a /cpukit/score/include/rtems | |
parent | score: Add _Chain_Insert_ordered_unprotected() (diff) | |
download | rtems-49cdf40afa1b67b1eedbec26b73c59f54dc882cd.tar.bz2 |
score: Add and use _Thread_Dispatch_is_enabled()
Delete _Thread_Dispatch_in_critical_section() and
_Thread_Is_dispatching_enabled().
Diffstat (limited to 'cpukit/score/include/rtems')
-rw-r--r-- | cpukit/score/include/rtems/score/coremutex.h | 2 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/threaddispatch.h | 45 |
2 files changed, 14 insertions, 33 deletions
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h index 10dfe06fa2..f6c377c2a0 100644 --- a/cpukit/score/include/rtems/score/coremutex.h +++ b/cpukit/score/include/rtems/score/coremutex.h @@ -352,7 +352,7 @@ void _CORE_mutex_Seize_interrupt_blocking( #define _CORE_mutex_Check_dispatch_for_seize(_wait) 0 #else #define _CORE_mutex_Check_dispatch_for_seize(_wait) \ - (_Thread_Dispatch_in_critical_section() \ + (!_Thread_Dispatch_is_enabled() \ && (_wait) \ && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING)) #endif diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h index 0333e9b66f..e3065da590 100644 --- a/cpukit/score/include/rtems/score/threaddispatch.h +++ b/cpukit/score/include/rtems/score/threaddispatch.h @@ -46,6 +46,19 @@ extern "C" { */ SCORE_EXTERN volatile uint32_t _Thread_Dispatch_disable_level; +/** + * @brief Indicates if the executing thread is inside a thread dispatch + * critical section. + * + * @retval true Thread dispatching is enabled. + * @retval false The executing thread is inside a thread dispatch critical + * section and dispatching is not allowed. + */ +RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled(void) +{ + return _Thread_Dispatch_disable_level == 0; +} + #if defined(RTEMS_SMP) typedef struct { SMP_lock_Control lock; @@ -68,14 +81,6 @@ SCORE_EXTERN volatile uint32_t _Thread_Dispatch_disable_level; void _Thread_Dispatch_initialization(void); /** - * @brief Checks if thread dispatch says that we are in a critical section. - * - * This routine returns true if thread dispatch indicates - * that we are in a critical section. - */ - bool _Thread_Dispatch_in_critical_section(void); - - /** * @brief Returns value of the the thread dispatch level. * * This routine returns value of the the thread dispatch level. @@ -105,20 +110,6 @@ SCORE_EXTERN volatile uint32_t _Thread_Dispatch_disable_level; uint32_t _Thread_Dispatch_decrement_disable_level(void); #else /* RTEMS_SMP */ /** - * @brief _Thread_Dispatch_in_critical_section - * - * This routine returns true if thread dispatch indicates - * that we are in a critical section. - */ - RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void) - { - if ( _Thread_Dispatch_disable_level == 0 ) - return false; - - return true; - } - - /** * @brief Get thread dispatch disable level. * * This routine returns value of the the thread dispatch level. @@ -246,16 +237,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void ) _Thread_Dispatch_decrement_disable_level(); } -/** - * This function returns true if dispatching is disabled, and false - * otherwise. - */ - -RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void ) -{ - return ( _Thread_Dispatch_in_critical_section() == false ); -} - /** @} */ #ifdef __cplusplus |