[PATCH 25/38] Optional POSIX Barrier initialization

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jan 26 15:37:51 UTC 2016


Update #2408.
---
 cpukit/posix/include/rtems/posix/barrierimpl.h | 10 +---------
 cpukit/posix/src/pbarrier.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/barrierimpl.h b/cpukit/posix/include/rtems/posix/barrierimpl.h
index 22be1c0..646b734 100644
--- a/cpukit/posix/include/rtems/posix/barrierimpl.h
+++ b/cpukit/posix/include/rtems/posix/barrierimpl.h
@@ -34,15 +34,7 @@ extern "C" {
  *  this class of objects.
  */
 
-POSIX_EXTERN Objects_Information  _POSIX_Barrier_Information;
-
-/**
- * @brief POSIX barrier manager initialization.
- *
- * This routine performs the initialization necessary for this manager.
- */
-
-void _POSIX_Barrier_Manager_initialization(void);
+extern Objects_Information _POSIX_Barrier_Information;
 
 /**
  * @brief POSIX translate barrier return code.
diff --git a/cpukit/posix/src/pbarrier.c b/cpukit/posix/src/pbarrier.c
index 5f32fcb..1ae3115 100644
--- a/cpukit/posix/src/pbarrier.c
+++ b/cpukit/posix/src/pbarrier.c
@@ -21,12 +21,15 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
+#include <rtems/sysinit.h>
 #include <rtems/posix/barrierimpl.h>
 
+Objects_Information _POSIX_Barrier_Information;
+
 /**
  *  @brief _POSIX_Barrier_Manager_initialization
  */
-void _POSIX_Barrier_Manager_initialization(void)
+static void _POSIX_Barrier_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_POSIX_Barrier_Information,    /* object information table */
@@ -44,3 +47,9 @@ void _POSIX_Barrier_Manager_initialization(void)
 #endif
   );
 }
+
+RTEMS_SYSINIT_ITEM(
+  _POSIX_Barrier_Manager_initialization,
+  RTEMS_SYSINIT_POSIX_BARRIER,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index f645946..5c6b077 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -31,7 +31,6 @@
 #include <sys/types.h>
 #include <mqueue.h>
 #include <rtems/config.h>
-#include <rtems/posix/barrierimpl.h>
 #include <rtems/posix/config.h>
 #include <rtems/posix/priorityimpl.h>
 #include <rtems/posix/psignalimpl.h>
@@ -58,7 +57,6 @@ void _POSIX_API_Initialize(void)
   _POSIX_Key_Manager_initialization();
 
   #ifdef RTEMS_POSIX_API
-    _POSIX_Barrier_Manager_initialization();
     _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 95865c4..27c193a 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -49,6 +49,7 @@ extern "C" {
 #define RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE        000364
 #define RTEMS_SYSINIT_POSIX_SEMAPHORE            000365
 #define RTEMS_SYSINIT_POSIX_TIMER                000366
+#define RTEMS_SYSINIT_POSIX_BARRIER              000367
 #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 1679cb6..c8135cd 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -28,6 +28,7 @@
 
 #include <rtems/extensionimpl.h>
 #ifdef RTEMS_POSIX_API
+#include <rtems/posix/barrierimpl.h>
 #include <rtems/posix/condimpl.h>
 #include <rtems/posix/mqueueimpl.h>
 #include <rtems/posix/muteximpl.h>
@@ -101,6 +102,8 @@ typedef enum {
   POSIX_SEMAPHORE_POST,
   POSIX_TIMER_PRE,
   POSIX_TIMER_POST,
+  POSIX_BARRIER_PRE,
+  POSIX_BARRIER_POST,
   POSIX_CLEANUP_PRE,
   POSIX_CLEANUP_POST,
 #endif /* RTEMS_POSIX_API */
@@ -437,6 +440,18 @@ LAST(RTEMS_SYSINIT_POSIX_TIMER)
   next_step(POSIX_TIMER_POST);
 }
 
+FIRST(RTEMS_SYSINIT_POSIX_BARRIER)
+{
+  assert(_POSIX_Barrier_Information.maximum == 0);
+  next_step(POSIX_BARRIER_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_BARRIER)
+{
+  assert(_POSIX_Barrier_Information.maximum != 0);
+  next_step(POSIX_BARRIER_POST);
+}
+
 static size_t user_extensions_pre_posix_cleanup;
 
 FIRST(RTEMS_SYSINIT_POSIX_CLEANUP)
@@ -566,6 +581,8 @@ static void Init(rtems_task_argument arg)
 
 #ifdef RTEMS_POSIX_API
 
+#define CONFIGURE_MAXIMUM_POSIX_BARRIERS 1
+
 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
 
 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
-- 
1.8.4.5




More information about the devel mailing list