[PATCH 5/9] posix: Convert to inline function
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jul 19 07:15:54 UTC 2013
On 2013-07-18 18:43, Ralf Corsepius wrote:
> On 07/17/2013 04:18 PM, Sebastian Huber wrote:
>> ---
>> cpukit/posix/include/rtems/posix/muteximpl.h | 20 ++++++++++++++++----
>> cpukit/posix/src/mutextranslatereturncode.c | 22 +---------------------
>> 2 files changed, 17 insertions(+), 25 deletions(-)
>>
>> diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h
>> b/cpukit/posix/include/rtems/posix/muteximpl.h
>> index d4673aa..29e93c2 100644
>> --- a/cpukit/posix/include/rtems/posix/muteximpl.h
>> +++ b/cpukit/posix/include/rtems/posix/muteximpl.h
>> @@ -38,6 +40,8 @@ POSIX_EXTERN Objects_Information _POSIX_Mutex_Information;
>>
>> POSIX_EXTERN pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
>>
>> +extern const int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1];
>> +
>> /*
>> * @brief POSIX Mutex Manager Initialization
>> *
>> @@ -144,11 +148,19 @@ int _POSIX_Mutex_Lock_support(
>> * willing to block but the operation was unable to complete within the time
>> * allotted because the resource never became available.
>> */
>> -
>> -int _POSIX_Mutex_Translate_core_mutex_return_code(
>> +RTEMS_INLINE_ROUTINE int _POSIX_Mutex_Translate_core_mutex_return_code(
>> CORE_mutex_Status the_mutex_status
>> -);
>> -
>> +)
>> +{
>> + /*
>> + * Internal consistency check for bad status from SuperCore
>> + */
>> + #if defined(RTEMS_DEBUG)
>> + if ( the_mutex_status > CORE_MUTEX_STATUS_LAST )
>> + return EINVAL;
>> + #endif
>> + return _POSIX_Mutex_Return_codes[the_mutex_status];
>> +}
>>
>> /*
>> * _POSIX_Mutex_Get
> I don't like this kind of changes, because they contradict to the working
> principles of data abstraction and encapsulation.
>
> They expose internal implementation details and symbols, no user should see.
>
> Many people, comprising me, consider this to be very bad coding style.
In general I agree, but in this particular case this change improves
performance. The mutex obtain/release operations are critical.
We may choose to not install the *impl.h files in the future.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list