Changeset a62a3c32 in rtems


Ignore:
Timestamp:
Aug 19, 2014, 3:43:36 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10
Children:
b47dffc
Parents:
f8811e4
git-author:
Sebastian Huber <sebastian.huber@…> (08/19/14 15:43:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/20/14 05:24:16)
Message:

score: PR2179: Fix initially locked PI mutex

Files:
3 edited

Legend:

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

    rf8811e4 ra62a3c32  
    6060
    6161  if ( initial_lock == CORE_MUTEX_LOCKED ) {
     62    bool is_priority_ceiling =
     63     _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes );
     64
    6265    the_mutex->nest_count = 1;
    6366    the_mutex->holder     = _Thread_Executing;
    6467    the_mutex->holder_id  = _Thread_Executing->Object.id;
    65     if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
    66          _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
     68
     69    if (  is_priority_ceiling ||
     70         _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
    6771      Priority_Control ceiling = the_mutex->Attributes.priority_ceiling;
    6872
    69       if ( _Thread_Executing->current_priority < ceiling )
     73      if ( is_priority_ceiling &&
     74           _Thread_Executing->current_priority < ceiling )
    7075       return CORE_MUTEX_STATUS_CEILING_VIOLATED;
    7176#ifdef __RTEMS_STRICT_ORDER_MUTEX__
     
    7681
    7782      _Thread_Executing->resource_count++;
    78       _Thread_Change_priority( _Thread_Executing, ceiling, false );
     83      if ( is_priority_ceiling )
     84        _Thread_Change_priority( _Thread_Executing, ceiling, false );
    7985    }
    8086  } else {
  • testsuites/sptests/sp51/init.c

    rf8811e4 ra62a3c32  
    1111
    1212#include <tmacros.h>
     13
     14static void test_create_initially_locked_prio_inherit_sema(void)
     15{
     16  rtems_status_code   sc;
     17  rtems_id            id;
     18  rtems_task_priority prio_a;
     19  rtems_task_priority prio_b;
     20  rtems_task_priority prio_ceiling = 0;
     21
     22  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_a);
     23  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     24
     25  rtems_test_assert(prio_a != prio_ceiling);
     26
     27  sc = rtems_semaphore_create(
     28    rtems_build_name( 'S', 'E', 'M', 'A' ),
     29    0,
     30    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
     31    prio_ceiling,
     32    &id
     33  );
     34  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     35
     36  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_b);
     37  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     38
     39  rtems_test_assert(prio_a == prio_b);
     40
     41  sc = rtems_semaphore_release(id);
     42  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     43
     44  sc = rtems_semaphore_delete(id);
     45  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     46}
    1347
    1448rtems_task Init(
     
    5185  directive_failed( sc, "rtems_semaphore_release" );
    5286
     87  test_create_initially_locked_prio_inherit_sema();
     88
    5389  puts( "*** END OF TEST 51 ***" );
    5490  rtems_test_exit( 0 );
Note: See TracChangeset for help on using the changeset viewer.