Changeset 3c1ad257 in rtems


Ignore:
Timestamp:
May 27, 2016, 7:41:18 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bac50cfc
Parents:
8a77ef63
git-author:
Sebastian Huber <sebastian.huber@…> (05/27/16 07:41:18)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/30/16 14:16:22)
Message:

rtems: Simplify rtems_semaphore_delete()

Due to the unified status codes, we can now use a common flush and
destroy method for semaphore and mutex variants.

Location:
cpukit
Files:
3 edited

Legend:

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

    r8a77ef63 r3c1ad257  
    8585
    8686  switch ( the_semaphore->variant ) {
    87     case SEMAPHORE_VARIANT_MUTEX:
    88       _CORE_mutex_Flush(
    89         &the_semaphore->Core_control.mutex,
    90         _Thread_queue_Flush_status_object_was_deleted,
    91         &queue_context
    92       );
    93       _CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
    94       break;
    9587#if defined(RTEMS_SMP)
    9688    case SEMAPHORE_VARIANT_MRSP:
     
    10092    default:
    10193      _Assert(
    102         the_semaphore->variant == SEMAPHORE_VARIANT_SIMPLE_BINARY
     94        the_semaphore->variant == SEMAPHORE_VARIANT_MUTEX
     95          || the_semaphore->variant == SEMAPHORE_VARIANT_SIMPLE_BINARY
    10396          || the_semaphore->variant == SEMAPHORE_VARIANT_COUNTING
    10497      );
    105       _CORE_semaphore_Destroy(
    106         &the_semaphore->Core_control.semaphore,
     98      _Thread_queue_Flush_critical(
     99        &the_semaphore->Core_control.Wait_queue.Queue,
    107100        _Semaphore_Get_operations( the_semaphore ),
     101        _Thread_queue_Flush_status_object_was_deleted,
    108102        &queue_context
    109103      );
     104      _Thread_queue_Destroy( &the_semaphore->Core_control.Wait_queue );
    110105      break;
    111106  }
  • cpukit/score/include/rtems/score/coremuteximpl.h

    r8a77ef63 r3c1ad257  
    315315);
    316316
    317 RTEMS_INLINE_ROUTINE void _CORE_mutex_Flush(
    318   CORE_mutex_Control        *the_mutex,
    319   Thread_queue_Flush_filter  filter,
    320   Thread_queue_Context      *queue_context
    321 )
    322 {
    323   _Thread_queue_Flush_critical(
    324     &the_mutex->Wait_queue.Queue,
    325     the_mutex->operations,
    326     filter,
    327     queue_context
    328   );
    329 }
    330 
    331317RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_owner(
    332318  const CORE_mutex_Control *the_mutex,
  • cpukit/score/include/rtems/score/coresemimpl.h

    r8a77ef63 r3c1ad257  
    142142}
    143143
    144 RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush(
    145   CORE_semaphore_Control        *the_semaphore,
    146   const Thread_queue_Operations *operations,
    147   Thread_queue_Context          *queue_context
    148 )
    149 {
    150   _Thread_queue_Flush_critical(
    151     &the_semaphore->Wait_queue.Queue,
    152     operations,
    153     _Thread_queue_Flush_status_unavailable,
    154     queue_context
    155   );
    156 }
    157 
    158144/**
    159145 * This routine returns the current count associated with the semaphore.
Note: See TracChangeset for help on using the changeset viewer.