[rtems commit] Optional POSIX Condition Variable initialization
Sebastian Huber
sebh at rtems.org
Wed Feb 3 09:32:58 UTC 2016
Module: rtems
Branch: master
Commit: f4fee4778e9ab8a61c00fdb34a6d2e49f2e0b2ce
Changeset: http://git.rtems.org/rtems/commit/?id=f4fee4778e9ab8a61c00fdb34a6d2e49f2e0b2ce
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Dec 14 16:29:19 2015 +0100
Optional POSIX Condition Variable initialization
Update #2408.
---
cpukit/posix/include/rtems/posix/condimpl.h | 9 +--------
cpukit/posix/src/cond.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(+), 11 deletions(-)
diff --git a/cpukit/posix/include/rtems/posix/condimpl.h b/cpukit/posix/include/rtems/posix/condimpl.h
index 7def0f8..789d3e8 100644
--- a/cpukit/posix/include/rtems/posix/condimpl.h
+++ b/cpukit/posix/include/rtems/posix/condimpl.h
@@ -36,7 +36,7 @@ extern "C" {
* The following defines the information control block used to manage
* this class of objects.
*/
-POSIX_EXTERN Objects_Information _POSIX_Condition_variables_Information;
+extern Objects_Information _POSIX_Condition_variables_Information;
/**
* The default condition variable attributes structure.
@@ -44,13 +44,6 @@ POSIX_EXTERN Objects_Information _POSIX_Condition_variables_Information;
extern const pthread_condattr_t _POSIX_Condition_variables_Default_attributes;
/**
- * @brief POSIX Condition Variable Manager Initialization
- *
- * This routine performs the initialization necessary for this manager.
- */
-void _POSIX_Condition_variables_Manager_initialization(void);
-
-/**
* @brief POSIX Condition Variable Allocate
*
* This function allocates a condition variable control block from
diff --git a/cpukit/posix/src/cond.c b/cpukit/posix/src/cond.c
index 5ce12d5..d0ce8a6 100644
--- a/cpukit/posix/src/cond.c
+++ b/cpukit/posix/src/cond.c
@@ -24,10 +24,13 @@
#include <rtems/system.h>
#include <rtems/config.h>
+#include <rtems/sysinit.h>
#include <rtems/score/watchdog.h>
#include <rtems/posix/condimpl.h>
#include <rtems/posix/muteximpl.h>
+Objects_Information _POSIX_Condition_variables_Information;
+
/*
* _POSIX_Condition_variables_Manager_initialization
*
@@ -39,7 +42,7 @@
* Output parameters: NONE
*/
-void _POSIX_Condition_variables_Manager_initialization(void)
+static void _POSIX_Condition_variables_Manager_initialization(void)
{
_Objects_Initialize_information(
&_POSIX_Condition_variables_Information, /* object information table */
@@ -58,3 +61,9 @@ void _POSIX_Condition_variables_Manager_initialization(void)
#endif
);
}
+
+RTEMS_SYSINIT_ITEM(
+ _POSIX_Condition_variables_Manager_initialization,
+ RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 4cf5249..9277c93 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -33,7 +33,6 @@
#include <rtems/config.h>
#include <rtems/posix/barrierimpl.h>
#include <rtems/posix/config.h>
-#include <rtems/posix/condimpl.h>
#include <rtems/posix/mqueueimpl.h>
#include <rtems/posix/muteximpl.h>
#include <rtems/posix/priorityimpl.h>
@@ -63,7 +62,6 @@ void _POSIX_API_Initialize(void)
_POSIX_Key_Manager_initialization();
#ifdef RTEMS_POSIX_API
- _POSIX_Condition_variables_Manager_initialization();
_POSIX_Mutex_Manager_initialization();
_POSIX_Message_queue_Manager_initialization();
_POSIX_Semaphore_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index dcd0e18..9d1e59e 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -44,6 +44,7 @@ extern "C" {
#define RTEMS_SYSINIT_CLASSIC_BARRIER 00034a
#define RTEMS_SYSINIT_POSIX_SIGNALS 000360
#define RTEMS_SYSINIT_POSIX_THREADS 000361
+#define RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE 000362
#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 8925099..87d0c32 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/condimpl.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthreadimpl.h>
#endif /* RTEMS_POSIX_API */
@@ -86,6 +87,8 @@ typedef enum {
POSIX_SIGNALS_POST,
POSIX_THREADS_PRE,
POSIX_THREADS_POST,
+ POSIX_CONDITION_VARIABLE_PRE,
+ POSIX_CONDITION_VARIABLE_POST,
POSIX_CLEANUP_PRE,
POSIX_CLEANUP_POST,
#endif /* RTEMS_POSIX_API */
@@ -362,6 +365,18 @@ LAST(RTEMS_SYSINIT_POSIX_THREADS)
next_step(POSIX_THREADS_POST);
}
+FIRST(RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE)
+{
+ assert(_POSIX_Condition_variables_Information.maximum == 0);
+ next_step(POSIX_CONDITION_VARIABLE_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE)
+{
+ assert(_POSIX_Condition_variables_Information.maximum != 0);
+ next_step(POSIX_CONDITION_VARIABLE_POST);
+}
+
static size_t user_extensions_pre_posix_cleanup;
FIRST(RTEMS_SYSINIT_POSIX_CLEANUP)
@@ -491,6 +506,8 @@ static void Init(rtems_task_argument arg)
#ifdef RTEMS_POSIX_API
+#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1
+
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
#endif /* RTEMS_POSIX_API */
More information about the vc
mailing list