diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-27 11:43:44 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-27 12:24:24 +0200 |
commit | ec84273de4fe79c338677b7d519ebdcd610a50c4 (patch) | |
tree | fd05b2c087320e372b1728315aad88a19d3de1e7 /cpukit | |
parent | sapi: Fix workspace size estimate (diff) | |
download | rtems-ec84273de4fe79c338677b7d519ebdcd610a50c4.tar.bz2 |
score: Replace _API_Mutex_Is_locked()
Replace _API_Mutex_Is_locked() with _API_Mutex_Is_owner().
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/score/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/apimutex.h | 11 | ||||
-rw-r--r-- | cpukit/score/src/apimutexisowner.c (renamed from cpukit/score/src/apimutexislocked.c) | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 11399e9c73..3b2c5bce15 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -160,7 +160,7 @@ endif ## CORE_APIMUTEX_C_FILES libscore_a_SOURCES += src/apimutex.c \ - src/apimutexlock.c src/apimutexislocked.c src/apimutexunlock.c + src/apimutexlock.c src/apimutexisowner.c src/apimutexunlock.c ## CORE_BARRIER_C_FILES libscore_a_SOURCES += src/corebarrier.c src/corebarrierrelease.c \ diff --git a/cpukit/score/include/rtems/score/apimutex.h b/cpukit/score/include/rtems/score/apimutex.h index 628ba5df1b..615f60b31d 100644 --- a/cpukit/score/include/rtems/score/apimutex.h +++ b/cpukit/score/include/rtems/score/apimutex.h @@ -85,7 +85,12 @@ void _API_Mutex_Lock( API_Mutex_Control *mutex ); */ void _API_Mutex_Unlock( API_Mutex_Control *mutex ); -bool _API_Mutex_Is_locked( const API_Mutex_Control *mutex ); +/** + * @brief Checks if the specified API mutex is owned by the executing thread. + * + * @param[in] mutex The API mutex. + */ +bool _API_Mutex_Is_owner( const API_Mutex_Control *mutex ); /** @} */ @@ -120,9 +125,9 @@ static inline void _RTEMS_Unlock_allocator( void ) _API_Mutex_Unlock( _RTEMS_Allocator_Mutex ); } -static inline bool _RTEMS_Check_if_allocator_is_locked( void ) +static inline bool _RTEMS_Allocator_is_owner( void ) { - return _API_Mutex_Is_locked( _RTEMS_Allocator_Mutex ); + return _API_Mutex_Is_owner( _RTEMS_Allocator_Mutex ); } SCORE_EXTERN API_Mutex_Control *_Once_Mutex; diff --git a/cpukit/score/src/apimutexislocked.c b/cpukit/score/src/apimutexisowner.c index 6435fbf650..a80c664cb3 100644 --- a/cpukit/score/src/apimutexislocked.c +++ b/cpukit/score/src/apimutexisowner.c @@ -1,8 +1,6 @@ /** * @file * - * @brief Check if the specified API mutex is locked. - * * @ingroup ScoreAPIMutex */ @@ -20,9 +18,9 @@ #endif #include <rtems/score/apimutex.h> -#include <rtems/score/coremuteximpl.h> +#include <rtems/score/threadimpl.h> -bool _API_Mutex_Is_locked( const API_Mutex_Control *the_mutex ) +bool _API_Mutex_Is_owner( const API_Mutex_Control *the_mutex ) { - return _CORE_mutex_Is_locked( &the_mutex->Mutex ); + return the_mutex->Mutex.holder == _Thread_Get_executing(); } |