[PATCH] score: PR2136: Fix _Thread_Change_priority()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Aug 9 06:10:21 UTC 2013


On 2013-08-09 07:54, Sebastian Huber wrote:
> On 2013-08-08 22:00, Chris Johns wrote:
>> Sebastian Huber wrote:
>>>   /**
>>> - * This function returns true if the currently executing thread
>>> - * is also the heir thread, and false otherwise.
>>> - */
>>> -
>>> -RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_also_the_heir( void )
>>
>> Why not pass the 'the_thread' to this call and keep the logic local rather than
>> ...
>>
>>> +  if ( _Thread_Is_executing( the_thread) || _Thread_Is_heir( the_thread ) )
>>
>> .. and ..
>>
>>> +  if ( _Thread_Is_executing( the_thread) || _Thread_Is_heir( the_thread ) )
>>
>> The code ...
>>
>>   if ( _Thread_Is_executing_also_the_heir( the_thread ) )
>>
>> ... clearly describes the intent rather than me needing to check the logic of
>> the above operation is correct in the context and not a copy and paste error.
>> Small mistakes in this area can be difficult to find.
>>
>> Chris
>
> _Thread_Is_executing( the_thread) || _Thread_Is_heir( the_thread )
>
> is not equal to
>
> _Thread_Is_executing_also_the_heir( void )
>

The copy and paste is on a higher level, e.g. we may use this:

RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
   void ( *extract )( Thread_Control *),
   void ( *schedule )( Thread_Control *),
   Thread_Control *thread
)
{
   ( *extract )( thread );

   if ( _Thread_Is_executing( the_thread) || _Thread_Is_heir( the_thread ) ) {
     ( *schedule )( thread, true );
   }
}

-- 
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