summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/once.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-08-23 14:56:36 +1000
committerChris Johns <chrisj@rtems.org>2013-08-23 14:56:36 +1000
commit6e4c01e3a2c07d3d42c510fbff70c14ccbafd2df (patch)
treeec6d62205983fabb345a6d84cd50804265fe3349 /cpukit/posix/src/once.c
parentbsps/arm: Add more CP15 cache functions (diff)
downloadrtems-6e4c01e3a2c07d3d42c510fbff70c14ccbafd2df.tar.bz2
posix: Update to the pthread_once changes.
Implement the reeview changes. Add a POSIX Fatal error domain. Fix confdefs.h to correctly handle the internal POSIX mutexes.
Diffstat (limited to 'cpukit/posix/src/once.c')
-rw-r--r--cpukit/posix/src/once.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/cpukit/posix/src/once.c b/cpukit/posix/src/once.c
index d77c3c12e3..e91daf2ca6 100644
--- a/cpukit/posix/src/once.c
+++ b/cpukit/posix/src/once.c
@@ -22,28 +22,25 @@
#include <errno.h>
#include <rtems.h>
+#include <rtems/posix/posixapi.h>
#include <rtems/posix/onceimpl.h>
-pthread_mutex_t _POSIX_Once_Lock;
-
void _POSIX_Once_Manager_initialization(void)
{
pthread_mutexattr_t mattr;
- int r;
+ int eno;
_POSIX_Once_Lock = PTHREAD_MUTEX_INITIALIZER;
- r = pthread_mutexattr_init( &mattr );
- if ( r != 0 )
- rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa0000 | r );
-
- r = pthread_mutexattr_settype( &mattr, PTHREAD_MUTEX_RECURSIVE );
- if ( r != 0 )
- rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa1000 | r );
+ eno = pthread_mutexattr_init( &mattr );
+ _Assert( eno == 0 );
+ eno = pthread_mutexattr_settype( &mattr, PTHREAD_MUTEX_RECURSIVE );
+ _Assert( eno == 0 );
- r = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
- if ( r != 0 )
- rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa2000 | r );
+ eno = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
+ if ( eno != 0 )
+ _POSIX_Fatal_error( POSIX_FD_PTHREAD_ONCE, eno );
- pthread_mutexattr_destroy( &mattr );
+ eno = pthread_mutexattr_destroy( &mattr );
+ _Assert( eno == 0 );
}