Changeset fc7584d7 in rtems


Ignore:
Timestamp:
07/13/22 13:14:47 (20 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5
Children:
b9de5b3b
Parents:
8d54187
git-author:
Sebastian Huber <sebastian.huber@…> (07/13/22 13:14:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/18/22 07:36:09)
Message:

score: Fix _Objects_Active_count()

With unlimited objects the object maximum may be larger than the sum of active
and inactive objects.

Update #4676.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/objectactivecount.c

    r8d54187 rfc7584d7  
    2525)
    2626{
    27   Objects_Maximum inactive;
    28   Objects_Maximum maximum;
     27  Objects_Maximum   active;
     28  Objects_Maximum   index;
     29  Objects_Maximum   maximum;
     30  Objects_Control **local_table;
    2931
    3032  _Assert( _Objects_Allocator_is_owner() );
    3133
    32   inactive = (Objects_Maximum)
    33     _Chain_Node_count_unprotected( &information->Inactive );
     34  active = 0;
    3435  maximum  = _Objects_Get_maximum_index( information );
     36  local_table = information->local_table;
    3537
    36   return maximum - inactive;
     38  for ( index = 0; index < maximum; ++index ) {
     39    if ( local_table[ index ] != NULL ) {
     40      ++active;
     41    }
     42  }
     43
     44  return active;
    3745}
Note: See TracChangeset for help on using the changeset viewer.