Changeset 8f0529f in rtems for cpukit/score/src/coresem.c


Ignore:
Timestamp:
Nov 2, 1999, 3:58:09 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
2cd5444
Parents:
9693fdac
Message:

Added maximum count detection logic.

File:
1 edited

Legend:

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

    r9693fdac r8f0529f  
    9292{
    9393  Thread_Control *the_thread;
     94  ISR_Level       level;
     95  CORE_semaphore_Status status;
     96
     97  status = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
    9498
    9599  if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) {
     
    98102      (*api_semaphore_mp_support) ( the_thread, id );
    99103
    100   } else
    101     the_semaphore->count += 1;
     104  } else {
     105    _ISR_Disable( level );
     106      if ( the_semaphore->count <= the_semaphore->Attributes.maximum_count )
     107        the_semaphore->count += 1;
     108      else
     109        status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
     110    _ISR_Enable( level );
     111  }
    102112
    103   return( CORE_SEMAPHORE_STATUS_SUCCESSFUL );
     113  return status;
    104114}
    105115
Note: See TracChangeset for help on using the changeset viewer.