Changeset 3ca6e618 in rtems


Ignore:
Timestamp:
May 25, 2016, 2:49:53 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
2581a56
Parents:
af746b0
git-author:
Sebastian Huber <sebastian.huber@…> (05/25/16 14:49:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/30/16 14:16:21)
Message:

rtems: Simplify rtems_semaphore_delete()

Location:
cpukit/rtems
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/sem.h

    raf746b0 r3ca6e618  
    7676  union {
    7777    /**
     78     * @brief The thread queue present in all other variants.
     79     */
     80    Thread_queue_Control Wait_queue;
     81
     82    /**
    7883     *  This is the SuperCore Mutex instance associated with this Classic
    7984     *  API Semaphore instance.
  • cpukit/rtems/src/semdelete.c

    raf746b0 r3ca6e618  
    3030  Thread_queue_Context  queue_context;
    3131  rtems_attribute       attribute_set;
     32  Status_Control        status;
    3233
    3334  _Objects_Allocator_lock();
     
    4849  attribute_set = the_semaphore->attribute_set;
    4950
     51  _Thread_queue_Acquire_critical(
     52    &the_semaphore->Core_control.Wait_queue,
     53    &queue_context.Lock_context
     54  );
     55
    5056#if defined(RTEMS_SMP)
    5157  if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
    52     Status_Control status;
    53 
    54     _MRSP_Acquire_critical(
    55       &the_semaphore->Core_control.mrsp,
    56       &queue_context
    57     );
    5858    status = _MRSP_Can_destroy( &the_semaphore->Core_control.mrsp );
    59     if ( status != STATUS_SUCCESSFUL ) {
    60       _MRSP_Release(
    61         &the_semaphore->Core_control.mrsp,
    62         &queue_context
    63       );
    64       _Objects_Allocator_unlock();
    65       return _Status_Get( status );
    66     }
    6759  } else
    6860#endif
    6961  if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
    70     _CORE_mutex_Acquire_critical(
    71       &the_semaphore->Core_control.mutex,
    72       &queue_context
    73     );
    74 
    7562    if (
    7663      _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex )
    7764        && !_Attributes_Is_simple_binary_semaphore( attribute_set )
    7865    ) {
    79       _CORE_mutex_Release(
    80         &the_semaphore->Core_control.mutex,
    81         &queue_context
    82       );
    83       _Objects_Allocator_unlock();
    84       return RTEMS_RESOURCE_IN_USE;
     66      status = STATUS_RESOURCE_IN_USE;
     67    } else {
     68      status = STATUS_SUCCESSFUL;
    8569    }
    8670  } else {
    87     _CORE_semaphore_Acquire_critical(
    88       &the_semaphore->Core_control.semaphore,
    89       &queue_context
     71    status = STATUS_SUCCESSFUL;
     72  }
     73
     74  if ( status != STATUS_SUCCESSFUL ) {
     75    _Thread_queue_Release(
     76      &the_semaphore->Core_control.Wait_queue,
     77      &queue_context.Lock_context
    9078    );
     79    _Objects_Allocator_unlock();
     80    return _Status_Get( status );
    9181  }
    9282
  • cpukit/rtems/src/semobtain.c

    raf746b0 r3ca6e618  
    2323#include <rtems/rtems/optionsimpl.h>
    2424#include <rtems/rtems/statusimpl.h>
     25
     26THREAD_QUEUE_OBJECT_ASSERT(
     27  Semaphore_Control,
     28  Core_control.Wait_queue
     29);
    2530
    2631THREAD_QUEUE_OBJECT_ASSERT(
Note: See TracChangeset for help on using the changeset viewer.