Changeset bba3507 in rtems


Ignore:
Timestamp:
Aug 19, 2014, 3:43:36 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
0a66c126
Parents:
3654667f
git-author:
Sebastian Huber <sebastian.huber@…> (08/19/14 15:43:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/20/14 06:17:49)
Message:

score: PR2179: Fix initially locked PI mutex

Files:
3 edited

Legend:

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

    r3654667f rbba3507  
    4040
    4141  if ( initially_locked ) {
     42    bool is_priority_ceiling =
     43      _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes );
     44
    4245    the_mutex->nest_count = 1;
    4346    the_mutex->holder     = executing;
    44     if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
    45          _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
     47
     48    if (  is_priority_ceiling ||
     49         _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
    4650      Priority_Control ceiling = the_mutex->Attributes.priority_ceiling;
    4751
     
    5357      _Thread_Disable_dispatch();
    5458
    55       if ( executing->current_priority < ceiling ) {
     59      if ( is_priority_ceiling && executing->current_priority < ceiling ) {
    5660        _Thread_Enable_dispatch();
    5761        return CORE_MUTEX_STATUS_CEILING_VIOLATED;
     
    6670      executing->resource_count++;
    6771
    68       _Thread_Change_priority( executing, ceiling, false );
     72      if ( is_priority_ceiling ) {
     73        _Thread_Change_priority( executing, ceiling, false );
     74      }
     75
    6976      _Thread_Enable_dispatch();
    7077    }
  • testsuites/sptests/sp51/init.c

    r3654667f rbba3507  
    1818/* forward declarations to avoid warnings */
    1919rtems_task Init(rtems_task_argument argument);
     20
     21static void test_create_initially_locked_prio_inherit_sema(void)
     22{
     23  rtems_status_code   sc;
     24  rtems_id            id;
     25  rtems_task_priority prio_a;
     26  rtems_task_priority prio_b;
     27  rtems_task_priority prio_ceiling = 0;
     28
     29  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_a);
     30  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     31
     32  rtems_test_assert(prio_a != prio_ceiling);
     33
     34  sc = rtems_semaphore_create(
     35    rtems_build_name( 'S', 'E', 'M', 'A' ),
     36    0,
     37    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
     38    prio_ceiling,
     39    &id
     40  );
     41  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     42
     43  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_b);
     44  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     45
     46  rtems_test_assert(prio_a == prio_b);
     47
     48  sc = rtems_semaphore_release(id);
     49  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     50
     51  sc = rtems_semaphore_delete(id);
     52  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     53}
    2054
    2155rtems_task Init(
     
    5892    sc, RTEMS_NOT_OWNER_OF_RESOURCE, "rtems_semaphore_release" );
    5993
     94  test_create_initially_locked_prio_inherit_sema();
     95
    6096  TEST_END();
    6197  rtems_test_exit( 0 );
Note: See TracChangeset for help on using the changeset viewer.