summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-08-14 10:21:41 +1000
committerChris Johns <chrisj@rtems.org>2013-08-14 10:21:41 +1000
commit03acc5915e002f0b03eee9e86212209705cca6d6 (patch)
tree93c452a3f546f0d6f4456481c78e9fc6d4a6e082 /cpukit/sapi
parentposix: Handle recursive attributes correctly. (diff)
downloadrtems-03acc5915e002f0b03eee9e86212209705cca6d6.tar.bz2
posix: Change pthread_once to be SMP safe.
Change pthread_once from using disabled pre-emption to using a pthread mutex making it SMP safe. GCC using a posix threading model uses pthread_once. The pthread mutex requires at least 1 mutex is configured so confdefs.h has been updated to account for the internal mutex.
Diffstat (limited to 'cpukit/sapi')
-rw-r--r--cpukit/sapi/include/confdefs.h7
-rw-r--r--cpukit/sapi/src/posixapi.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 50db8779af..2a3af15912 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1695,6 +1695,11 @@ const rtems_libio_helper rtems_fs_init_helper =
#include <rtems/posix/timer.h>
/**
+ * POSIX Once support uses a single mutex.
+ */
+ #define CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES 1
+
+ /**
* Account for the object control structures plus the name
* of the object to be duplicated.
*/
@@ -1856,6 +1861,7 @@ const rtems_libio_helper rtems_fs_init_helper =
#define CONFIGURE_MEMORY_FOR_POSIX \
( CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES + \
+ CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES + \
CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES) + \
CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES( \
CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES + \
@@ -2304,6 +2310,7 @@ const rtems_libio_helper rtems_fs_init_helper =
CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS +
CONFIGURE_MAXIMUM_GOROUTINES,
CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_GNAT_MUTEXES +
+ CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES +
CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS +
CONFIGURE_GO_INIT_MUTEXES + CONFIGURE_MAXIMUM_GO_CHANNELS,
CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index af9ba2cac3..2d784a1671 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -33,6 +33,7 @@
#include <rtems/posix/keyimpl.h>
#include <rtems/posix/mqueueimpl.h>
#include <rtems/posix/muteximpl.h>
+#include <rtems/posix/onceimpl.h>
#include <rtems/posix/posixapi.h>
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h>
@@ -66,6 +67,7 @@ void _POSIX_API_Initialize(void)
_POSIX_Key_Manager_initialization();
_POSIX_Mutex_Manager_initialization();
_POSIX_Message_queue_Manager_initialization();
+ _POSIX_Once_Manager_initialization();
_POSIX_Semaphore_Manager_initialization();
_POSIX_Timer_Manager_initialization();
_POSIX_Barrier_Manager_initialization();