[rtems commit] posix: Change pthread_once to be SMP safe.

Chris Johns chrisj at rtems.org
Wed Aug 14 08:37:59 UTC 2013

Sebastian Huber wrote:
> On 2013-08-14 10:00, Chris Johns wrote:
>>>> + r = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
>>>> + if ( r != 0 )
>>>> + rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa2000 | r );
>>> This is a configuration error. We need a proper error code for this with
>> Agree. I will change it to INTERNAL_ERROR_POSIX_API. I am not sure
>> what you
>> mean by proper error code.
> I just realized that we need new enums for the RTEMS and POSIX API
> errors. The fatal error handling in the RTEMS and POSIX API is currently
> a hack due to the missing unique (source, code) pair identifying the
> exact error location.
> So we need enums similar to Internal_errors_Core_list for the RTEMS and
> POSIX API associated with the error sources INTERNAL_ERROR_RTEMS_API and

In the case of the POSIX API it may pay to define values with the bottom 
8 bits an errno error code. This would match the current 2 uses in the 
internal error in the POSIX. For example for the pthread_once mutex init 
it would be ...

  _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, true,
                _POSIX_Error( POSIX_PTHREAD_ONCE_ERROR, eno ));

Note, POSIX_PTHREAD_ONCE_ERROR can be whatever.


More information about the devel mailing list