diff options
author | Chris Johns <chrisj@rtems.org> | 2013-08-23 14:56:36 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-08-23 14:56:36 +1000 |
commit | 6e4c01e3a2c07d3d42c510fbff70c14ccbafd2df (patch) | |
tree | ec6d62205983fabb345a6d84cd50804265fe3349 /cpukit/posix/src/once.c | |
parent | bsps/arm: Add more CP15 cache functions (diff) | |
download | rtems-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.c | 25 |
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 ); } |