[rtems commit] Use linker set for POSIX User Threads init
Sebastian Huber
sebh at rtems.org
Wed Feb 3 09:36:00 UTC 2016
Module: rtems
Branch: master
Commit: 4210114032d8d079bddaa2333875c38e30c93490
Changeset: http://git.rtems.org/rtems/commit/?id=4210114032d8d079bddaa2333875c38e30c93490
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Jan 26 11:13:45 2016 +0100
Use linker set for POSIX User Threads init
Update #2408.
---
cpukit/posix/include/rtems/posix/pthreadimpl.h | 9 --------
cpukit/posix/src/pthread.c | 24 --------------------
cpukit/sapi/include/confdefs.h | 9 ++++----
cpukit/score/include/rtems/sysinit.h | 1 +
testsuites/sptests/spsysinit01/init.c | 31 ++++++++++++++++++++++++++
5 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h b/cpukit/posix/include/rtems/posix/pthreadimpl.h
index 9aff71c..870b5f9 100644
--- a/cpukit/posix/include/rtems/posix/pthreadimpl.h
+++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h
@@ -52,15 +52,6 @@ extern Thread_Information _POSIX_Threads_Information;
extern pthread_attr_t _POSIX_Threads_Default_attributes;
/**
- * When the user configures a set of POSIX API initialization threads,
- * This variable will point to the method used to initialize them.
- *
- * NOTE: It is instantiated and initialized by confdefs.h based upon
- * application requirements.
- */
-extern void (*_POSIX_Threads_Initialize_user_threads_p)(void);
-
-/**
* @brief Copy POSIX Thread attribute structure.
*
* This routine copies the attr2 thread attribute structure
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 6c4ea5c..84d2e72 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -285,28 +285,6 @@ static void _POSIX_Threads_Exitted_extension(
pthread_exit( executing->Wait.return_argument );
}
-/*
- * _POSIX_Threads_Initialize_user_threads
- *
- * This routine creates and starts all configured user
- * initialization threads.
- */
-static void _POSIX_Threads_Initialize_user_threads( void )
-{
- if ( _POSIX_Threads_Initialize_user_threads_p )
- (*_POSIX_Threads_Initialize_user_threads_p)();
-}
-
-/*
- * API Extension control structures
- */
-API_extensions_Control _POSIX_Threads_API_extensions = {
- #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API)
- .predriver_hook = NULL,
- #endif
- .postdriver_hook = _POSIX_Threads_Initialize_user_threads
-};
-
User_extensions_Control _POSIX_Threads_User_extensions = {
{ NULL, NULL },
{ { NULL, NULL }, NULL },
@@ -363,8 +341,6 @@ static void _POSIX_Threads_Manager_initialization(void)
*/
_User_extensions_Add_API_set( &_POSIX_Threads_User_extensions );
- _API_extensions_Add( &_POSIX_Threads_API_extensions );
-
/*
* If we supported MP, then here we would ...
* Register the MP Process Packet routine.
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 62db039..ee2558c 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -3461,10 +3461,11 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#ifdef CONFIGURE_INIT
#if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
- void (*_POSIX_Threads_Initialize_user_threads_p)(void) =
- _POSIX_Threads_Initialize_user_threads_body;
- #else
- void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
+ RTEMS_SYSINIT_ITEM(
+ _POSIX_Threads_Initialize_user_threads_body,
+ RTEMS_SYSINIT_POSIX_USER_THREADS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+ );
#endif
#endif
#endif
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 84eec29..e7b9c63 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -70,6 +70,7 @@ extern "C" {
#define RTEMS_SYSINIT_DRVMGR_LEVEL_4 000704
#define RTEMS_SYSINIT_MP_FINALIZE 000705
#define RTEMS_SYSINIT_CLASSIC_USER_TASKS 000706
+#define RTEMS_SYSINIT_POSIX_USER_THREADS 000707
#define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS 000800
/*
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 0acb567..0aeb4ee 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -134,6 +134,10 @@ typedef enum {
DEVICE_DRIVERS_POST,
CLASSIC_USER_TASKS_PRE,
CLASSIC_USER_TASKS_POST,
+#ifdef RTEMS_POSIX_API
+ POSIX_USER_THREADS_PRE,
+ POSIX_USER_THREADS_POST,
+#endif /* RTEMS_POSIX_API */
STD_FILE_DESCRIPTORS_PRE,
STD_FILE_DESCRIPTORS_POST,
INIT_TASK,
@@ -618,6 +622,22 @@ LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS)
next_step(CLASSIC_USER_TASKS_POST);
}
+#ifdef RTEMS_POSIX_API
+
+FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS)
+{
+ assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0);
+ next_step(POSIX_USER_THREADS_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_USER_THREADS)
+{
+ assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1);
+ next_step(POSIX_USER_THREADS_POST);
+}
+
+#endif /* RTEMS_POSIX_API */
+
FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS)
{
struct stat st;
@@ -649,6 +669,15 @@ static void Init(rtems_task_argument arg)
exit(0);
}
+#ifdef RTEMS_POSIX_API
+
+static void *POSIX_Init(void *arg)
+{
+ return NULL;
+}
+
+#endif /* RTEMS_POSIX_API */
+
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
@@ -692,6 +721,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
#endif /* RTEMS_POSIX_API */
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
More information about the vc
mailing list