[rtems commit] score: Make _Once_Lock() and _Once_Unlock() static

Sebastian Huber sebh at rtems.org
Tue May 4 11:08:07 UTC 2021


Module:    rtems
Branch:    master
Commit:    3e16f1a6e22a15e73bf3f45f656b5d856db1dfa0
Changeset: http://git.rtems.org/rtems/commit/?id=3e16f1a6e22a15e73bf3f45f656b5d856db1dfa0

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue May  4 09:36:00 2021 +0200

score: Make _Once_Lock() and _Once_Unlock() static

These two functions are no longer used outside of _Once().

---

 cpukit/include/rtems/score/onceimpl.h | 16 ----------------
 cpukit/score/src/once.c               | 32 ++++++++++++++++----------------
 2 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/cpukit/include/rtems/score/onceimpl.h b/cpukit/include/rtems/score/onceimpl.h
index fcd831a..bac19f0 100644
--- a/cpukit/include/rtems/score/onceimpl.h
+++ b/cpukit/include/rtems/score/onceimpl.h
@@ -57,22 +57,6 @@ extern "C" {
  */
 int _Once( unsigned char *once_state, void ( *init_routine )( void ) );
 
-/**
- * @brief Locks the Once_Information_Mutex and returns the thread life state.
- *
- * @return The thread life state (THREAD_LIFE_PROTECTED).
- */
-Thread_Life_state _Once_Lock( void );
-
-/**
- * @brief Unlocks the Once_Information_Mutex and sets the thread life
- *      protection to thread_life_state.
- *
- * @param thread_life_state The thread life state to set the thread life
- *      protection to.
- */
-void _Once_Unlock( Thread_Life_state thread_life_state );
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/once.c b/cpukit/score/src/once.c
index cf576e9..f3a29e5 100644
--- a/cpukit/score/src/once.c
+++ b/cpukit/score/src/once.c
@@ -59,6 +59,22 @@ static Once_Control _Once_Information = {
   .State = RTEMS_CONDITION_VARIABLE_INITIALIZER( "_Once" )
 };
 
+static Thread_Life_state _Once_Lock( void )
+{
+  Thread_Life_state thread_life_state;
+
+  thread_life_state = _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
+  rtems_mutex_lock( &_Once_Information.Mutex );
+
+  return thread_life_state;
+}
+
+static void _Once_Unlock( Thread_Life_state thread_life_state )
+{
+  rtems_mutex_unlock( &_Once_Information.Mutex );
+  _Thread_Set_life_protection( thread_life_state );
+}
+
 int _Once( unsigned char *once_state, void ( *init_routine )( void ) )
 {
   _Atomic_Fence( ATOMIC_ORDER_ACQUIRE );
@@ -90,19 +106,3 @@ int _Once( unsigned char *once_state, void ( *init_routine )( void ) )
 
   return 0;
 }
-
-Thread_Life_state _Once_Lock( void )
-{
-  Thread_Life_state thread_life_state;
-
-  thread_life_state = _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
-  rtems_mutex_lock( &_Once_Information.Mutex );
-
-  return thread_life_state;
-}
-
-void _Once_Unlock( Thread_Life_state thread_life_state )
-{
-  rtems_mutex_unlock( &_Once_Information.Mutex );
-  _Thread_Set_life_protection( thread_life_state );
-}



More information about the vc mailing list