[rtems commit] Optional POSIX RWLock initialization

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:34:02 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Dec 14 16:39:10 2015 +0100

Optional POSIX RWLock initialization

Update #2408.

---

 cpukit/posix/include/rtems/posix/rwlockimpl.h | 10 +---------
 cpukit/posix/src/prwlock.c                    | 11 ++++++++++-
 cpukit/sapi/src/posixapi.c                    |  2 --
 cpukit/score/include/rtems/sysinit.h          |  1 +
 testsuites/sptests/spsysinit01/init.c         | 17 +++++++++++++++++
 5 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/rwlockimpl.h b/cpukit/posix/include/rtems/posix/rwlockimpl.h
index 46e3390..8c94843 100644
--- a/cpukit/posix/include/rtems/posix/rwlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/rwlockimpl.h
@@ -34,15 +34,7 @@ extern "C" {
  * this class of objects.
  */
 
-POSIX_EXTERN Objects_Information  _POSIX_RWLock_Information;
-
-/**
- * @brief POSIX RWLock manager initialization.
- *
- * This routine performs the initialization necessary for this manager.
- */
-
-void _POSIX_RWLock_Manager_initialization(void);
+extern Objects_Information _POSIX_RWLock_Information;
 
 /**
  * @brief POSIX translate core RWLock return code.
diff --git a/cpukit/posix/src/prwlock.c b/cpukit/posix/src/prwlock.c
index 05df65a..10c88d9 100644
--- a/cpukit/posix/src/prwlock.c
+++ b/cpukit/posix/src/prwlock.c
@@ -17,13 +17,16 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
+#include <rtems/sysinit.h>
 #include <rtems/posix/rwlockimpl.h>
 
+Objects_Information _POSIX_RWLock_Information;
+
 /**
  *  @brief _POSIX_RWLock_Manager_initialization
  */
 
-void _POSIX_RWLock_Manager_initialization(void)
+static void _POSIX_RWLock_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_POSIX_RWLock_Information,     /* object information table */
@@ -41,3 +44,9 @@ void _POSIX_RWLock_Manager_initialization(void)
 #endif
   );
 }
+
+RTEMS_SYSINIT_ITEM(
+  _POSIX_RWLock_Manager_initialization,
+  RTEMS_SYSINIT_POSIX_RWLOCK,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 5c6b077..2ff526f 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -34,7 +34,6 @@
 #include <rtems/posix/config.h>
 #include <rtems/posix/priorityimpl.h>
 #include <rtems/posix/psignalimpl.h>
-#include <rtems/posix/rwlockimpl.h>
 #include <rtems/posix/spinlockimpl.h>
 #endif
 
@@ -57,7 +56,6 @@ void _POSIX_API_Initialize(void)
   _POSIX_Key_Manager_initialization();
 
   #ifdef RTEMS_POSIX_API
-    _POSIX_RWLock_Manager_initialization();
     _POSIX_Spinlock_Manager_initialization();
   #endif
 }
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 27c193a..27ee0c9 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -50,6 +50,7 @@ extern "C" {
 #define RTEMS_SYSINIT_POSIX_SEMAPHORE            000365
 #define RTEMS_SYSINIT_POSIX_TIMER                000366
 #define RTEMS_SYSINIT_POSIX_BARRIER              000367
+#define RTEMS_SYSINIT_POSIX_RWLOCK               000368
 #define RTEMS_SYSINIT_POSIX_CLEANUP              00036a
 #define RTEMS_SYSINIT_IDLE_THREADS               000380
 #define RTEMS_SYSINIT_BSP_LIBC                   000400
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index c8135cd..e5d6dc9 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -34,6 +34,7 @@
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/psignalimpl.h>
 #include <rtems/posix/pthreadimpl.h>
+#include <rtems/posix/rwlockimpl.h>
 #include <rtems/posix/semaphoreimpl.h>
 #include <rtems/posix/timerimpl.h>
 #endif /* RTEMS_POSIX_API */
@@ -104,6 +105,8 @@ typedef enum {
   POSIX_TIMER_POST,
   POSIX_BARRIER_PRE,
   POSIX_BARRIER_POST,
+  POSIX_RWLOCK_PRE,
+  POSIX_RWLOCK_POST,
   POSIX_CLEANUP_PRE,
   POSIX_CLEANUP_POST,
 #endif /* RTEMS_POSIX_API */
@@ -452,6 +455,18 @@ LAST(RTEMS_SYSINIT_POSIX_BARRIER)
   next_step(POSIX_BARRIER_POST);
 }
 
+FIRST(RTEMS_SYSINIT_POSIX_RWLOCK)
+{
+  assert(_POSIX_RWLock_Information.maximum == 0);
+  next_step(POSIX_RWLOCK_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_RWLOCK)
+{
+  assert(_POSIX_RWLock_Information.maximum != 0);
+  next_step(POSIX_RWLOCK_POST);
+}
+
 static size_t user_extensions_pre_posix_cleanup;
 
 FIRST(RTEMS_SYSINIT_POSIX_CLEANUP)
@@ -589,6 +604,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1
 
+#define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 1
+
 #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
 
 #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1




More information about the vc mailing list