<p dir="ltr"><br>
On Jun 2, 2014 9:18 AM, Gedare Bloom <gedare@rtems.org> wrote:<br>
><br>
> >> @@ -200,27 +250,36 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Obtain(<br>
> >> MRSP_Status status;<br>
> >> const Scheduler_Control *scheduler = _Scheduler_Get( executing );<br>
> >> uint32_t scheduler_index = _Scheduler_Get_index( scheduler );<br>
> >> + Priority_Control initial_priority = executing->current_priority;<br>
> >> Priority_Control ceiling_priority =<br>
> >> _MRSP_Get_ceiling_priority( mrsp, scheduler_index );<br>
> >> bool priority_ok = !_Scheduler_Is_priority_higher_than(<br>
> >> scheduler,<br>
> >> - executing->current_priority,<br>
> >> + initial_priority,<br>
> >> ceiling_priority<br>
> >> );<br>
> >> + Resource_Node *owner = _Resource_Get_owner( &mrsp->Resource );<br>
> > I'd put this after the priority_ok check, for better readability by<br>
> > keeping the error check closer to the cause. (Ahem, this should<br>
> > probably be in our conventions too, eh?)<br>
> ><br>
> >><br>
> >> if ( !priority_ok) {<br>
> >> return MRSP_INVALID_PRIORITY;<br>
> >> }<br>
> >><br>
> I guess I wasn't clear, I meant you should do owner =<br>
> _Resource_Get_owner() here. e.g.<br>
> -----<br>
> Resource_Node *owner;<br>
> bool priority_ok = !_Scheduler_Is_priority_higher_than(<br>
> scheduler,<br>
> initial_priority,<br>
> ceiling_priority<br>
> );<br>
> if ( !priority_ok) {<br>
> return MRSP_INVALID_PRIORITY;<br>
> }<br>
> owner = _Resource_Get_owner( &mrsp->Resource );<br>
> -----<br>
><br>
> Also, at one point in time we discussed about a rule of not having<br>
> function calls in variable initialization. I will look if that is an<br>
> actual convention or not, but it would make this code easier to read.</p>
<p dir="ltr">I personally find function calls in variable initialization a potential source of undesirable side-effects.</p>
<p dir="ltr">Does this resource tracking replace the code for strict order mutex? </p>
<p dir="ltr">> -Gedare<br>
> _______________________________________________<br>
> rtems-devel mailing list<br>
> rtems-devel@rtems.org<br>
> http://www.rtems.org/mailman/listinfo/rtems-devel<br>
</p>