diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-27 13:38:04 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-31 08:29:43 +0200 |
commit | 346845730cb7cdd3f2a1e9231cced7cdfd046ce1 (patch) | |
tree | 3764fe70bfaea1d230d5052982b3bff6b1322e13 /cpukit/score/include/rtems/score/apimutex.h | |
parent | score: Relax Giant lock usage for API mutexes (diff) | |
download | rtems-346845730cb7cdd3f2a1e9231cced7cdfd046ce1.tar.bz2 |
score: Use thread life protection for API mutexes
This prevents that asynchronous thread deletion can lead to an unusable
allocator or once mutex.
Diffstat (limited to 'cpukit/score/include/rtems/score/apimutex.h')
-rw-r--r-- | cpukit/score/include/rtems/score/apimutex.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/cpukit/score/include/rtems/score/apimutex.h b/cpukit/score/include/rtems/score/apimutex.h index 380f054181..5f02e0a1cf 100644 --- a/cpukit/score/include/rtems/score/apimutex.h +++ b/cpukit/score/include/rtems/score/apimutex.h @@ -47,6 +47,12 @@ typedef struct { * Contains the SuperCore mutex information. */ CORE_mutex_Control Mutex; + + /** + * @brief The thread life protection state before the outer-most mutex + * obtain. + */ + bool previous_thread_life_protection; } API_Mutex_Control; /** @@ -66,18 +72,16 @@ void _API_Mutex_Initialization( uint32_t maximum_mutexes ); void _API_Mutex_Allocate( API_Mutex_Control **mutex ); /** - * @brief Acquires the specified API mutex. + * @brief Acquires the specified API mutex. + * + * @param[in] mutex The API mutex. */ -void _API_Mutex_Lock( - API_Mutex_Control *mutex - ); +void _API_Mutex_Lock( API_Mutex_Control *mutex ); /** - * @brief Releases the specified API mutex. + * @brief Releases the specified API mutex. * - * Releases the specified @a mutex. - * - * @param[in] mutex is the mutex to be removed. + * @param[in] mutex The API mutex. */ void _API_Mutex_Unlock( API_Mutex_Control *mutex ); @@ -104,21 +108,15 @@ void _API_Mutex_Unlock( API_Mutex_Control *mutex ); */ SCORE_EXTERN API_Mutex_Control *_RTEMS_Allocator_Mutex; -/** - * @brief Macro to ease locking the allocator mutex. - * - * This macro makes it explicit that one is locking the allocator mutex. - */ -#define _RTEMS_Lock_allocator() \ - _API_Mutex_Lock( _RTEMS_Allocator_Mutex ) +static inline void _RTEMS_Lock_allocator( void ) +{ + _API_Mutex_Lock( _RTEMS_Allocator_Mutex ); +} -/** - * @brief Macro to ease unlocking the allocator mutex. - * - * This macro makes it explicit that one is unlocking the allocator mutex. - */ -#define _RTEMS_Unlock_allocator() \ - _API_Mutex_Unlock( _RTEMS_Allocator_Mutex ) +static inline void _RTEMS_Unlock_allocator( void ) +{ + _API_Mutex_Unlock( _RTEMS_Allocator_Mutex ); +} SCORE_EXTERN API_Mutex_Control *_Once_Mutex; |