Changeset 0dd49d0 in rtems


Ignore:
Timestamp:
Oct 31, 2016, 3:10:32 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
9e7fa07
Parents:
6e31b56f
git-author:
Sebastian Huber <sebastian.huber@…> (10/31/16 15:10:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/03/16 09:55:48)
Message:

score: Introduce thread resource count methods

This makes it easier to conditionally enable/disable the thread resource
count usage.

Location:
cpukit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/semcreate.c

    r6e31b56f r0dd49d0  
    149149          executing
    150150        );
    151         ++executing->resource_count;
     151        _Thread_Resource_count_increment( executing );
    152152      }
    153153
  • cpukit/score/include/rtems/score/coremuteximpl.h

    r6e31b56f r0dd49d0  
    150150  if ( owner == NULL ) {
    151151    _CORE_mutex_Set_owner( &the_mutex->Mutex, executing );
    152     ++executing->resource_count;
     152    _Thread_Resource_count_increment( executing );
    153153    _CORE_mutex_Release( &the_mutex->Mutex, queue_context );
    154154    return STATUS_SUCCESSFUL;
     
    197197  }
    198198
    199   --executing->resource_count;
     199  _Thread_Resource_count_decrement( executing );
    200200  _CORE_mutex_Set_owner( &the_mutex->Mutex, NULL );
    201201
     
    299299
    300300  _CORE_mutex_Set_owner( &the_mutex->Recursive.Mutex, owner );
    301   ++owner->resource_count;
     301  _Thread_Resource_count_increment( owner );
    302302  _Thread_Priority_add(
    303303    owner,
     
    391391  }
    392392
    393   --executing->resource_count;
     393  _Thread_Resource_count_decrement( executing );
    394394
    395395  _Thread_queue_Context_clear_priority_updates( queue_context );
     
    417417#endif
    418418    {
    419       ++new_owner->resource_count;
     419      _Thread_Resource_count_increment( new_owner );
    420420      _Thread_Priority_add(
    421421        new_owner,
  • cpukit/score/include/rtems/score/threadimpl.h

    r6e31b56f r0dd49d0  
    972972  _Assert( _Thread_State_is_owner( the_thread ) );
    973973  return ( the_thread->Life.state & THREAD_LIFE_DETACHED ) == 0;
     974}
     975
     976RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment(
     977  Thread_Control *the_thread
     978)
     979{
     980  ++the_thread->resource_count;
     981}
     982
     983RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement(
     984  Thread_Control *the_thread
     985)
     986{
     987  --the_thread->resource_count;
    974988}
    975989
  • cpukit/score/src/mutex.c

    r6e31b56f r0dd49d0  
    132132  heads = mutex->Queue.Queue.heads;
    133133  mutex->Queue.Queue.owner = NULL;
    134   --executing->resource_count;
     134  _Thread_Resource_count_decrement( executing );
    135135
    136136  if ( __predict_true( heads == NULL ) ) {
     
    162162  if ( __predict_true( owner == NULL ) ) {
    163163    mutex->Queue.Queue.owner = executing;
    164     ++executing->resource_count;
     164    _Thread_Resource_count_increment( executing );
    165165    _Mutex_Queue_release( mutex, &queue_context );
    166166  } else {
     
    188188  if ( __predict_true( owner == NULL ) ) {
    189189    mutex->Queue.Queue.owner = executing;
    190     ++executing->resource_count;
     190    _Thread_Resource_count_increment( executing );
    191191    _Mutex_Queue_release( mutex, &queue_context );
    192192
     
    230230  if ( __predict_true( owner == NULL ) ) {
    231231    mutex->Queue.Queue.owner = executing;
    232     ++executing->resource_count;
     232    _Thread_Resource_count_increment( executing );
    233233    eno = 0;
    234234  } else {
     
    278278  if ( __predict_true( owner == NULL ) ) {
    279279    mutex->Mutex.Queue.Queue.owner = executing;
    280     ++executing->resource_count;
     280    _Thread_Resource_count_increment( executing );
    281281    _Mutex_Queue_release( &mutex->Mutex, &queue_context );
    282282  } else if ( owner == executing ) {
     
    307307  if ( __predict_true( owner == NULL ) ) {
    308308    mutex->Mutex.Queue.Queue.owner = executing;
    309     ++executing->resource_count;
     309    _Thread_Resource_count_increment( executing );
    310310    _Mutex_Queue_release( &mutex->Mutex, &queue_context );
    311311
     
    354354  if ( __predict_true( owner == NULL ) ) {
    355355    mutex->Mutex.Queue.Queue.owner = executing;
    356     ++executing->resource_count;
     356    _Thread_Resource_count_increment( executing );
    357357    eno = 0;
    358358  } else if ( owner == executing ) {
  • cpukit/score/src/threadqenqueue.c

    r6e31b56f r0dd49d0  
    713713#endif
    714714  {
    715     ++new_owner->resource_count;
     715    _Thread_Resource_count_increment( new_owner );
    716716  }
    717717
Note: See TracChangeset for help on using the changeset viewer.